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
Passing only feed id instead of the whole object for Delayed Job
While running Stringer in a Docker container, there was an issue on passing the
Feed data to the Delayed Job.
The whole object was serialized by the application (FetchFeeds class) and
deserialized by the Delayed Job.
That's not a good practice and can cause several issues, as you can see in
collectiveidea/delayed_job_active_record#101
To solve this, instead of passing the whole Feed object to the Delayed Job, only
its id attribute is sent. Then, the Feed is get from the database and its
content is fetched normally.
Plus, the @pool object (a pool of threads) was also serialized and sent, causing
issues.
If no pool is passed to the job, it should be instantiated from inside the job
itself, avoiding the serialize/unserialize issues.
Keeping the pool argument in the FetchFeeds#initialize method ensures the tests
can still mock it and run the defined expect clauses.
0 commit comments