rails--rails/activejob/test/jobs
Jonathan Hefner 648da12519 Wrap evaluation of db/seeds.rb with the executor
Before #34953, when using the `:async` Active Job queue adapter, jobs
enqueued in `db/seeds.rb`, such as Active Storage analysis jobs, would
cause a hang (see #34939).  Therefore, #34953 changed all jobs enqueued
in `db/seeds.rb` to use the `:inline` queue adapter instead.  (This
behavior was later limited to only take effect when the `:async` adapter
was configured, see #35905.)  However, inline jobs in `db/seeds.rb`
cleared `CurrentAttributes` values (see #37526).  Therefore, #37568
changed the `:inline` adapter to wrap each job in its own thread, for
isolation.  However, wrapping a job in its own thread affects which
database connection it uses.  Thus inline jobs can no longer execute
within the calling thread's database transaction, including seeing any
uncommitted changes.  Additionally, if the calling thread is not wrapped
with the executor, the inline job thread (which is wrapped with the
executor) can deadlock on the load interlock.  And when testing (with
`connection_pool.lock_thread = true`), the inline job thread can
deadlock on one of the locks added by #28083.

Therefore, this commit reverts the solutions of #34953 and #37568, and
instead wraps evaluation of `db/seeds.rb` with the executor.  This
eliminates the original hang from #34939, which was also due to running
multiple threads and not wrapping all of them with the executor.  And,
because nested calls to `executor.wrap` are ignored, any inline jobs in
`db/seeds.rb` will not clear `CurrentAttributes` values.

Alternative fix for #34939.
Reverts #34953.
Reverts #35905.
Partially reverts #35896.

Alternative fix for #37526.
Reverts #37568.

Fixes #40552.
2020-11-18 16:26:20 -06:00
..
abort_before_enqueue_job.rb Don't run AJ after_enqueue / after_perform when chain is halted: 2019-12-09 17:17:23 +01:00
application_job.rb
callback_job.rb
disable_log_job.rb Add an option to disable logging for jobs with sensitive arguments 2019-11-08 13:53:23 -05:00
gid_job.rb
hello_job.rb
inherited_job.rb
kwargs_job.rb
logging_job.rb
multiple_kwargs_job.rb Make `assert_<enqueued|performed>_with()` compare hashes ignoring order of keys 2018-09-21 00:09:40 +05:30
nested_job.rb
overridden_logging_job.rb
prefixed_job.rb Stop queue_name_prefix from being global 2019-09-13 18:30:19 -03:00
provider_jid_job.rb
queue_adapter_job.rb
queue_as_job.rb
raising_job.rb Fix AJ `TestAdapter#performed_jobs` not properly counting job: 2020-03-09 19:46:11 -04:00
rescue_job.rb
retry_job.rb Disable ActiveJob retry jitter when given zero/falsey value (#38003) 2019-12-17 15:23:52 -03:00
timezone_dependent_job.rb Require time extensions in the job that depends on time 2019-08-02 00:52:02 -04:00
translated_hello_job.rb