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

Avoid rebuilding cache when the primary model has been destroyed #38

Merged
merged 1 commit into from
Sep 24, 2021

Conversation

praveenram
Copy link
Collaborator

Summary

Restrict the queueing of RefillJob to only happen on create and update events, avoid queueing the job on destroy.

Thermos uses globalid serialization for the ActiveJob params when available, to serialize the self instance variable to the queue backend, which is then automatically deserialized by Rails / ActiveJob, reference.

For any records that were destroyed, the serialization will happen without an issue with the in-memory instance of the model, but during deserialization by the background job worker, the record will not be available causing the RefillJob to fail.

Potential Improvement:

  • Instead of avoiding queueing the job, we can also clear any existing data from cache from the record.

Copy link
Owner

@athal7 athal7 left a comment

Choose a reason for hiding this comment

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

Looks great thanks @praveenram !

@athal7 athal7 merged commit 08a73fc into athal7:main Sep 24, 2021
@praveenram praveenram deleted the delete-event branch September 27, 2021 18:37
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.

None yet

2 participants