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

Wrap built-in enums and add deprecation warning for unwrapped enums #513

Merged
merged 5 commits into from
Oct 21, 2024

Conversation

bdewater
Copy link
Contributor

Addresses #468 - cc @kirs following our discussion at Rails World.

Copy link
Contributor Author

@bdewater bdewater left a comment

Choose a reason for hiding this comment

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

I think before this gets merged, we should add a concrete example of using the wrapper, otherwise the original question I had #468 still goes unanswered and it looks like busy work. ThrottleEnumerator looks like a good one to use, but I don't remember if Kir told me Shopify uses it this way?

One other thing we could do but it's a less explicit API than generally seems to be the style used: we could detect if wrapping is needed when build_enumerator is called:

enumerator = build_enumerator(*arguments, cursor: cursor_position)
unless enumerator.is_a?(JobIteration.enumerator_builder::Wrapper)
  enumerator = enumerator_builder.wrap(enumerator)
end

@bdewater
Copy link
Contributor Author

@Mangara addressed feedback and added an example, PTAL :)

@Mangara Mangara merged commit 5966715 into Shopify:main Oct 21, 2024
25 checks passed
@bdewater bdewater deleted the wrap-all-the-enums branch October 22, 2024 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants