Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/workers/environments/auto_recover_worker.rb')
-rw-r--r--app/workers/environments/auto_recover_worker.rb22
1 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..75e86e38f1a
--- /dev/null
+++ b/app/workers/environments/auto_recover_worker.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+module Environments
+ class AutoRecoverWorker
+ include ApplicationWorker
+
+ deduplicate :until_executed
+ 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