Vote #81775
未完了Mailer.with_synched_deliveries is not thread-safe
0%
説明
The @Mailer.with_synched_deliveries@ method sets global state (that is: the queue adapter used to queue new jobs) for the duration of the block.
This affects the global state of all concurrent threads, rather than just the current thread. If a multi-threaded application server or queueing system is in use (such as puma or resque), this can result in unintended consequences such as jobs not scheduled to the "normal" queuing system or errors being raised (if a job is supposed to be scheduled for a fixed later time which is not supported by the @InlineAdapter@).
As such, the method should be updated to only have a thread-local effect. This may possibly be achieved by introducing a fixed queue adapter wrapper which forwards requests to enqueue jobs to either the "normal" async adapter or the inline adapter based on a thread-local variable set by @Mailer.with_synched_deliveries@.
journals
--------------------------------------------------------------------------------
related_issues
relates,Closed,36393,Mailer.with_synched_deliveries doesn't correctly detect other async Queue adapters