diff options
Diffstat (limited to 'app/workers/environments/auto_recover_worker.rb')
-rw-r--r-- | app/workers/environments/auto_recover_worker.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/app/workers/environments/auto_recover_worker.rb b/app/workers/environments/auto_recover_worker.rb new file mode 100644 index 00000000000..76a807571b2 --- /dev/null +++ b/app/workers/environments/auto_recover_worker.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Environments + class AutoRecoverWorker + include ApplicationWorker + + data_consistency :delayed + idempotent! + feature_category :continuous_delivery + + def perform(environment_id, _params = {}) + Environment.find_by_id(environment_id).try do |environment| + next unless environment.long_stopping? + + next unless environment.stop_actions.all?(&:complete?) + + environment.recover_stuck_stopping + end + end + end +end |