You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the title says, you can't use the handle_asynchronously option inside an object that will be persisted as a subdocument.
In the example below, every time you create a comment, the job will be created, but when the worker picks it up for execution, nothing will happen because calling comment.find(:id) will return nil
classPostincludeMongoid::Documentembeds_many:commentsendclassCommentincludeMongoid::Documentembedded_in:postafter_create:notify_post_authordefnotify_post_authorNotification.create(user: post.user,text: 'you got a comment')endhandle_asynchronously:notify_post_author,queue: 'notifications'end
This is referenced in Issue #11 however it leads to another gem rather than a fix, so I'm curious as to why this wasn't addressed by this gem
The text was updated successfully, but these errors were encountered:
This is indeed an issue and I experienced this in my own app. The problem is that DelayedJob's class serialization is treating the embedded document as if it were a parent-level document, and looks for its collection.
Instead, we need to serialize the parent document, and then "drill-down" to the relevant embedded document -- potentially multiple levels of nesting.
I will consider a fix for this later.
dblock
changed the title
Worker doesn't pickup jobs created bya mongoid embedded document
Worker doesn't pickup jobs created by a mongoid embedded document
Jan 31, 2023
As the title says, you can't use the
handle_asynchronously
option inside an object that will be persisted as a subdocument.In the example below, every time you create a comment, the job will be created, but when the worker picks it up for execution, nothing will happen because calling
comment.find(:id)
will return nilThis is referenced in Issue #11 however it leads to another gem rather than a fix, so I'm curious as to why this wasn't addressed by this gem
The text was updated successfully, but these errors were encountered: