-
Notifications
You must be signed in to change notification settings - Fork 104
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
Documentation: Warning against memoization #122
Comments
A documentation PR is welcome, though it should probably be more specific about the fact that event subscriptions are singletons that just respond to With that said, and/or alternatively, and/or optimally, I suppose there's also room to adjust the |
First, I'd like to thank you for the great gem which helped us a lot while integrating Stripe in our app. Still, we were victim of the memoization issue, and I'd like to insist on the fact that the use of a Singleton, instantiated in an initializer can lead to a lot of issues.
Here, instantiating So to prevent this issue, we changed this code to:
I hope it will help other having strange issues with their recorders. |
+1, and I would expand this to code reloading also, since I've just spent some hours figuring out why code reloading doesn't work with a service object that I pass into the above mentioned initializer (thought it to be a Zeitwerk issue or something). In hindsight it all makes sense. But it isn't obvious if you just mindlessly follow the setup guide. |
BTW Using |
@rromanchuk What kind of problems you mean? |
@kirylpl related to the subscribed class, like:
and
and then running the server with
|
There's only one subscriber instantiated from this configure block:
And that means that you can't have methods in StripeInvoiceEvent that memoize:
The text was updated successfully, but these errors were encountered: