Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Remove deprecation warning #152

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

antstorm
Copy link
Contributor

@antstorm antstorm commented Mar 3, 2022

Fixes #143

After #92 was merged we've added a deprecation warning to restrict references to Temporal.configuration from the code. However we still rely on it heavily from Temporal::Concerns::Payloads that is included in quite a few places. This PR removes this issue in favour of explicit dependency injection.

The meat of this PR is the introduction of Temporal::ConverterWrapper (that now houses all the convenience methods from Temporal::Concerns::Payloads) and passing it explicitly where conversion functionality is needed.

Ideally in the future we should limit conversion to the our API wrapper (Connection::GRPC) and not allow any proto objects beyond that layer. But this is a much bigger refactor (many proto messages would require a local class).

Tested using existing unit & integration specs. New unit specs added to cover added functionality.

@@ -130,7 +125,7 @@ class TestSerializer
event_type { Temporal::Api::Enums::V1::EventType::EVENT_TYPE_ACTIVITY_TASK_CANCELED }
activity_task_canceled_event_attributes do |attrs|
Temporal::Api::History::V1::ActivityTaskCanceledEventAttributes.new(
details: TestSerializer.to_details_payloads('ACTIVITY_ID_NOT_STARTED'),
details: Temporal::Configuration.new.converter.to_details_payloads('ACTIVITY_ID_NOT_STARTED'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be $converter.to_details_payloads(...)? Not sure why you are allocating a new one here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, forgot to replace this one 👍

Copy link
Contributor

@chuckremes2 chuckremes2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good as a draft. Most of the changes were pretty repetitive so no comments on those. Main focus is probably on spec/unit/lib/temporal/converter_wrapper_spec.rb since that's where the ConverterWrapper gets tested. Looks complete to me.

I think the move to dependency injection is a good idea. I like the concept overall.

@antstorm antstorm marked this pull request as ready for review March 24, 2022 16:42
@0xTheProDev
Copy link
Contributor

Is there any update here? @antstorm @chuckremes2

@santiagodoldan
Copy link
Contributor

It would be awesome to merge this one 💯

@arrowcircle
Copy link

Any updates on this?

@cdimitroulas
Copy link

What is needed to get this over the line? It would be great to finally have a fix which removes the spam of log messages from temporal-ruby in our applications 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Deprecation message spam
6 participants