class SomeAction < ApplicationRecord
include ActionModel::ProcessesAsync
include ActionModel::TargetsMany
end
Base's dispatch will override ProcessesAsync's dispatch and cause the job to run inline, which we can safely assume is never the author's intent.
This PR fatally errors when this situation is detected. We exit instead of raise because an exception thrown in included is sometimes, but not always, caught in loading and I couldn't figure out why or how.
ActionModel::ProcessesAsync
must be included afterActionModel::Base
and if it isn't bad things happen.In this case:
TargetsMany
requiresBase
which defines thedispatch
method to just callperform
.ProcessesAsync
overrides thedispatch
method to instead kick a Sidekiq job.However, in the inverse case:
Base
's dispatch will overrideProcessesAsync
'sdispatch
and cause the job to run inline, which we can safely assume is never the author's intent.This PR fatally errors when this situation is detected. We
exit
instead ofraise
because an exception thrown inincluded
is sometimes, but not always, caught in loading and I couldn't figure out why or how.