summaryrefslogtreecommitdiff
path: root/app/workers
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2017-12-16 02:39:55 +0100
committerMatija Čupić <matteeyah@gmail.com>2017-12-16 04:00:35 +0100
commit68b95cd01e674cd2dbce45c49f5be04c223b718d (patch)
tree1ddfc864b13c2b411009fef628af5eb98352fc1e /app/workers
parent291480f5e17fea424692f979db91d2ec62d24dbd (diff)
downloadgitlab-ce-68b95cd01e674cd2dbce45c49f5be04c223b718d.tar.gz
Add CheckGcpProjectBillingWorker
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/check_gcp_project_billing_worker.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/workers/check_gcp_project_billing_worker.rb b/app/workers/check_gcp_project_billing_worker.rb
new file mode 100644
index 00000000000..97638f65e8d
--- /dev/null
+++ b/app/workers/check_gcp_project_billing_worker.rb
@@ -0,0 +1,16 @@
+class CheckGcpProjectBillingWorker
+ include ApplicationWorker
+
+ def self.redis_shared_state_key_for(token)
+ "gitlab:gcp:#{token}:billing_enabled"
+ end
+
+ def perform(token)
+ return unless token
+
+ billing_enabled = CheckGcpProjectBillingService.new.execute(token)
+ Gitlab::Redis::SharedState.with do |redis|
+ redis.set(self.class.redis_shared_state_key_for(token), billing_enabled)
+ end
+ end
+end