rails-cloud-tasks 0.0.3 → 0.0.4.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rails_cloud_tasks/scheduler.rb +17 -10
- data/lib/rails_cloud_tasks/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec0083f5d83803a2b0bd92726e11895503c587389d1026ee44ff8756e7df323c
|
4
|
+
data.tar.gz: 799198caaac170f445738b613915f4153b1e73badb5108b70e487e12d63b5992
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5720cdc6e5fdf8914c0bc176f464236297d578a2be4f63662a734e124fc27072f84115f63a76b73ae557931c85be35cb593c24a27799ddd80923e2e24a0e5151
|
7
|
+
data.tar.gz: ba96fb91bc9c06fdf50d63242a2bafd73716dcca87d66ca1b0fa0f883aa07d04c4bb8fcdf82047da065de4192649279bb50b7b657f30ce06cf3d050fa0163ede
|
@@ -23,15 +23,7 @@ module RailsCloudTasks
|
|
23
23
|
def upsert
|
24
24
|
result = { success: [], failure: [] }
|
25
25
|
scheduler_jobs.each do |job|
|
26
|
-
success
|
27
|
-
begin
|
28
|
-
client.create_job parent: location_path, job: job
|
29
|
-
rescue Google::Cloud::AlreadyExistsError
|
30
|
-
client.update_job job: job
|
31
|
-
rescue StandardError
|
32
|
-
success = false
|
33
|
-
end
|
34
|
-
success ? (result[:success] << job[:name]) : (result[:failure] << job[:name])
|
26
|
+
upsert_job(job) ? (result[:success] << job[:name]) : (result[:failure] << job[:name])
|
35
27
|
end
|
36
28
|
log_output(result)
|
37
29
|
end
|
@@ -53,7 +45,7 @@ module RailsCloudTasks
|
|
53
45
|
description: job[:description],
|
54
46
|
time_zone: job[:time_zone],
|
55
47
|
http_target: {
|
56
|
-
uri: "#{host}#{tasks_path}/#{job[:name]}",
|
48
|
+
uri: "#{host}#{tasks_path}/#{job[:class_name] || job[:name]}",
|
57
49
|
http_method: 'POST',
|
58
50
|
body: job[:args].to_json
|
59
51
|
}.merge(auth)
|
@@ -84,5 +76,20 @@ module RailsCloudTasks
|
|
84
76
|
logger.info(desc)
|
85
77
|
logger.info(prefix + tasks.join("\n #{prefix}"))
|
86
78
|
end
|
79
|
+
|
80
|
+
private
|
81
|
+
|
82
|
+
def upsert_job(job)
|
83
|
+
success = true
|
84
|
+
begin
|
85
|
+
client.create_job parent: location_path, job: job
|
86
|
+
rescue Google::Cloud::AlreadyExistsError
|
87
|
+
client.update_job job: job
|
88
|
+
rescue StandardError => e
|
89
|
+
logger.error(e)
|
90
|
+
success = false
|
91
|
+
end
|
92
|
+
success
|
93
|
+
end
|
87
94
|
end
|
88
95
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-cloud-tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilherme Araújo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-03-
|
11
|
+
date: 2021-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -312,9 +312,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
312
312
|
version: '2.4'
|
313
313
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
314
314
|
requirements:
|
315
|
-
- - "
|
315
|
+
- - ">"
|
316
316
|
- !ruby/object:Gem::Version
|
317
|
-
version:
|
317
|
+
version: 1.3.1
|
318
318
|
requirements: []
|
319
319
|
rubygems_version: 3.1.4
|
320
320
|
signing_key:
|