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_stop_worker.rb')
-rw-r--r--app/workers/environments/auto_stop_worker.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/workers/environments/auto_stop_worker.rb b/app/workers/environments/auto_stop_worker.rb
new file mode 100644
index 00000000000..672a4f4121e
--- /dev/null
+++ b/app/workers/environments/auto_stop_worker.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+module Environments
+ class AutoStopWorker
+ include ApplicationWorker
+
+ data_consistency :always
+ idempotent!
+ feature_category :continuous_delivery
+
+ def perform(environment_id, params = {})
+ Environment.find_by_id(environment_id).try do |environment|
+ user = environment.stop_action&.user
+ environment.stop_with_action!(user)
+ end
+ end
+ end
+end