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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5059f50ae4598ee23d9abec5ddac5eb2e1c8d4a2023ff794b08461b8611d6d73
4
- data.tar.gz: 15cb24ec98ffde490596bbdb0a1dff7145e98dcf15aadfb4a5c12093dd8dbfba
3
+ metadata.gz: ec0083f5d83803a2b0bd92726e11895503c587389d1026ee44ff8756e7df323c
4
+ data.tar.gz: 799198caaac170f445738b613915f4153b1e73badb5108b70e487e12d63b5992
5
5
  SHA512:
6
- metadata.gz: c9076b550dfbdbb3909633ee5f262613df39efc844d06d4a6c6e9153863b18480dc70405c728999465298a7b3950a29454db4f7c5bef926b5d2330cefc7e840d
7
- data.tar.gz: cab15a28e2083170c65643b7ae58bd83ac2a359b767a3bfa138d6ffc32021767c526dafe4fbf1edc3f0a53b4714ffde19d4128b95081563a70c705e7ac6bd813
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 = true
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
@@ -1,3 +1,3 @@
1
1
  module RailsCloudTasks
2
- VERSION = '0.0.3'.freeze
2
+ VERSION = '0.0.4.rc1'.freeze
3
3
  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.3
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-05 00:00:00.000000000 Z
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: '0'
317
+ version: 1.3.1
318
318
  requirements: []
319
319
  rubygems_version: 3.1.4
320
320
  signing_key: