Comments (2)
Yeah, don't do that :) There's all kinds of objects that DJ can't reliably serialize and blindly using delay
on arbitrary object types is dangerous.
Best practice is to call delay with the ids of the objects and refetch them in the job. This way you're not serializing some huge object graph and always get the freshest version of the data. Ex: UserMailer.delay.send_products_update_update_notification(user.id, my_products.pluck(:id))
from delayed_job_active_record.
betamatt is right, do not pass the my_products, pass its reference in the form of singular object as (variable or array) by which you could retrieve appropriate products.
from delayed_job_active_record.
Related Issues (20)
- Rails 6.1.0.alpha support HOT 3
- `Delayed::Job` no longer defined in initializers HOT 16
- Delayed::DeserializationError: Job failed to load: undefined class/module Spree::AccountSalesRecordMailer.
- undefined method `table_name=` for Delayed::Backend::ActiveRecord::Job:Class HOT 1
- 4.1.5 breaking changes HOT 5
- A way to get the job ID inside a worker? HOT 2
- Error in 4.1.5 when upgrading Rails from 6.0 to 6.1 HOT 2
- Job running on 2 workers at once after timeout HOT 1
- Delayed job stops, the jobs are stuck in postgres HOT 6
- Rails 7 Support HOT 9
- Use case for locked_by in the ready_to_run query HOT 1
- Use `update` instead of `update_all` in the reserve_with_scope_using_optimized_mysql method.
- Do that destroy_failed_jobs get honored by delayed_job?
- Problem with DelayedJob Psych gem when upgrading to Ruby 2.7.5 HOT 2
- Rails 7 weird error: can't dump anonymous module HOT 3
- Can't create Delayed::Job record after `errors.add` in model HOT 1
- How does max_attempts interface with ActiveJob retry_on method?
- Deprecation warning in rails 7.1 HOT 1
- Need a new release to support rails 7.1
- Don't optimize mysql query with trilogy gem
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from delayed_job_active_record.