job-iteration 0.9.5 → 0.9.6

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
  SHA1:
3
- metadata.gz: b5dbb0dadbd0368e6b75a7725118d82cd49ed38d
4
- data.tar.gz: 7a601058a648e433b30c409c76244c8ad1b71edd
3
+ metadata.gz: 6093efe949b8033cac444ce502bfe4e68057802c
4
+ data.tar.gz: c191823dcf19c97b304ad00cd09f900fc8768eda
5
5
  SHA512:
6
- metadata.gz: 4a3952c608d5f087e680c31973a7617caeca9afbfb4eae80645ea3e9d9b3e11131b0c7659ef5a77086e8e0d00221620ca0015c47874d6f09b62a81ba12d26f2f
7
- data.tar.gz: fe5fca4a552996a268d2f2b386a4cea11e4e0eaa933d00fa79fc0d2a8a967168b7e8b2f584e3c5756d9260614f87181524cdb79ee1e28227c908bfbf17898d12
6
+ metadata.gz: 6fbd13a06347fe7d60062f99ecf4d61544e54cf646f6e07f823e6c889cf4c6d98ba3163324d96f142ed7faebe978f8277ff45c8a69d866f9366a3eb8cdd60a06
7
+ data.tar.gz: 7857493464003d53119e93a5bc29a149bb251524ef9a8a5d4b9dfcc00bf843e5de478ea3c2fda537f91b4884eacaf82a412905e1212ef7df4c0b3d6c58fe3cb0
data/.travis.yml CHANGED
@@ -3,13 +3,12 @@ services:
3
3
  - redis-server
4
4
  language: ruby
5
5
  rvm:
6
- - 2.4.4
7
- - 2.5.1
6
+ - 2.4.5
7
+ - 2.5.3
8
8
  before_install:
9
- - gem install bundler -v 1.16.0
9
+ - gem install bundler
10
10
  - mysql -e 'CREATE DATABASE job_iteration_test;'
11
11
  script:
12
12
  - bundle exec rake test
13
13
  - bundle exec rubocop
14
14
  - bundle exec yardoc --no-output --no-save --no-stats --fail-on-warning
15
-
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- job-iteration (0.9.5)
4
+ job-iteration (0.9.6)
5
5
  activejob (~> 5.2)
6
6
 
7
7
  GEM
@@ -112,4 +112,4 @@ DEPENDENCIES
112
112
  yard
113
113
 
114
114
  BUNDLED WITH
115
- 1.16.3
115
+ 1.16.6
data/dev.yml ADDED
@@ -0,0 +1,19 @@
1
+ # This file is for Shopify employees development environment.
2
+ # If you are an external contributor you don't have to bother with it.
3
+ name: job-iteration
4
+
5
+ up:
6
+ - homebrew:
7
+ - mysql-client:
8
+ or: [mysql@5.7]
9
+ - ruby:
10
+ version: 2.5.3
11
+ - railgun
12
+ - bundler
13
+ - custom:
14
+ name: Create Job Iteration database
15
+ meet: mysql -uroot -h job-iteration.railgun -e "CREATE DATABASE job_iteration_test"
16
+ met?: mysql -uroot -h job-iteration.railgun job_iteration_test -e "SELECT 1"
17
+
18
+ commands:
19
+ test: bundle exec rake
@@ -72,6 +72,11 @@ module JobIteration
72
72
  interruptible_perform(*params)
73
73
  end
74
74
 
75
+ def retry_job(*)
76
+ @retried = true
77
+ super
78
+ end
79
+
75
80
  private
76
81
 
77
82
  def enumerator_builder
@@ -108,7 +113,7 @@ module JobIteration
108
113
 
109
114
  run_callbacks :shutdown
110
115
 
111
- if completed
116
+ if run_complete_callbacks?(completed)
112
117
  run_callbacks :complete
113
118
  output_interrupt_summary
114
119
  end
@@ -148,11 +153,6 @@ module JobIteration
148
153
  retry_job unless @retried
149
154
  end
150
155
 
151
- def retry_job(*)
152
- @retried = true
153
- super
154
- end
155
-
156
156
  def adjust_total_time
157
157
  self.total_time += (Time.now.utc.to_f - start_time.to_f).round(6)
158
158
  end
@@ -204,5 +204,19 @@ module JobIteration
204
204
 
205
205
  JobIteration.interruption_adapter.call || (defined?(super) && super)
206
206
  end
207
+
208
+ def run_complete_callbacks?(completed)
209
+ # nil means that someone aborted the job but want to call the on_complete callback
210
+ if completed.nil?
211
+ completed = :finished
212
+ end
213
+
214
+ case completed
215
+ when :finished, true then true
216
+ # skip_complete_callbacks is returning from ThrottleEnumeratorand we do not want the on_complete callback to
217
+ # be executed
218
+ when false, :skip_complete_callbacks then false
219
+ end
220
+ end
207
221
  end
208
222
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JobIteration
4
- VERSION = "0.9.5"
4
+ VERSION = "0.9.6"
5
5
  end
data/railgun.yml ADDED
@@ -0,0 +1,16 @@
1
+ # https://development.shopify.io/tools/dev/railgun/Railgun-Config
2
+ name: job-iteration
3
+
4
+ vm:
5
+ image: /opt/dev/misc/railgun-images/default
6
+ ip_address: 192.168.64.142
7
+ memory: 1G
8
+ cores: 2
9
+
10
+ volumes:
11
+ root: '500M'
12
+
13
+ services:
14
+ - redis
15
+ - mysql
16
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: job-iteration
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-29 00:00:00.000000000 Z
11
+ date: 2018-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob
@@ -84,6 +84,7 @@ files:
84
84
  - README.md
85
85
  - Rakefile
86
86
  - bin/setup
87
+ - dev.yml
87
88
  - guides/best-practices.md
88
89
  - guides/custom-enumerator.md
89
90
  - guides/iteration-how-it-works.md
@@ -98,6 +99,7 @@ files:
98
99
  - lib/job-iteration/iteration.rb
99
100
  - lib/job-iteration/test_helper.rb
100
101
  - lib/job-iteration/version.rb
102
+ - railgun.yml
101
103
  homepage: https://github.com/shopify/job-iteration
102
104
  licenses:
103
105
  - MIT