-
Notifications
You must be signed in to change notification settings - Fork 120
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
Identity map not cleared #23
Comments
This is a very serious issue. It causes nearly all non-trivial uses of DJ+Mongoid to fail in mysterious ways. I hacked this together as a workaround: #
# clear Mongoid::IdentityMap before each job
#
module Delayed
module Plugins
class ClearIdentityMap < Plugin
callbacks do |lifecycle|
lifecycle.before(:invoke_job) do |worker, &block|
Mongoid::IdentityMap.clear
end
end
end
end
end
Delayed::Worker.plugins << Delayed::Plugins::ClearIdentityMap |
That's much cleaner than what I've been using... but I feel this should be fixed in this project. Any thoughts from @collectiveidea ? 👍 |
hey guys, any thoughts on this? |
I ran into serious trouble because of this issue 👍 |
+1 |
Can someone please put together a pull request with tests that fail on master? |
Fixes issue #23 identity map not cleared
The Mongoid::IdentityMap should probably be cleared between job runs, as it is for ActiveRecord in:
https://github.com/collectiveidea/delayed_job/blob/5c7628d40c9e2e26ab2076453ab6488df3464730/lib/delayed/backend/base.rb#L92
The text was updated successfully, but these errors were encountered: