diff options
Diffstat (limited to 'app/workers/environments')
-rw-r--r-- | app/workers/environments/auto_recover_worker.rb | 21 | ||||
-rw-r--r-- | app/workers/environments/auto_stop_cron_worker.rb | 1 |
2 files changed, 22 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 diff --git a/app/workers/environments/auto_stop_cron_worker.rb b/app/workers/environments/auto_stop_cron_worker.rb index 4d6453a85e7..26b18c406e5 100644 --- a/app/workers/environments/auto_stop_cron_worker.rb +++ b/app/workers/environments/auto_stop_cron_worker.rb @@ -13,6 +13,7 @@ module Environments def perform AutoStopService.new.execute + AutoRecoverService.new.execute end end end |