dynflow 0.8.32 → 0.8.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b538623ca2c12b55a2f3937293d72bc00ae2dff
4
- data.tar.gz: efa72daede2802ffab30178cb01034ff224eea94
3
+ metadata.gz: 331deb991c6fe8d4617af49ce8072fe0edceef6f
4
+ data.tar.gz: 8de8181ec0b0451fefab469ee496172b8f1938dc
5
5
  SHA512:
6
- metadata.gz: f422a9edaf501a2157ddf7adaff12416226037baa08a7245317980e0701fb36506401087af65f370037ec4b5e7f105fd8b97f2417bd4cea57a1e66c2624af98a
7
- data.tar.gz: 3988359a776fdc9d34960779d12a8c9f8a2a67af599a39f13998dfdb05a64ed36972d80ba10a4f59996bb519d0ac7874f172fbf359ff5468fa7079adf1b802ae
6
+ metadata.gz: 90d6626cc3af5a24784985ac6efd3beb029a50524b899f3ba9028248ddd0952cab7d72f46284cb1595a2d8ec74512a4d0247a77e41011306ec5a237d51c18e43
7
+ data.tar.gz: 5db089dc8165ea98ad5677e8a4849e369c6329b856023084cdd6cc4b9ef4427a6bd39a59e8921be689ba3b03b7427138647b636ec02c386ff03610d2d5009631
@@ -34,7 +34,7 @@ module Dynflow
34
34
  end
35
35
 
36
36
  def clock_tick
37
- @world.clock.progress
37
+ @world.clock.progress_all([:periodic_check_inbox])
38
38
  end
39
39
 
40
40
  def feed_queue(work_items)
@@ -17,15 +17,21 @@ module Dynflow
17
17
  @pending_pings.sort!
18
18
  end
19
19
 
20
- def progress
20
+ def progress(ignored_subjects = [])
21
21
  if next_ping = @pending_pings.shift
22
- # we are testing an isolated system = we can move in time
23
- # without actually waiting
24
- @current_time = next_ping.when
25
- next_ping.apply
22
+ if !next_ping.what.respond_to?(:value) || !ignored_subjects.include?(next_ping.what.value)
23
+ # we are testing an isolated system = we can move in time
24
+ # without actually waiting
25
+ @current_time = next_ping.when
26
+ next_ping.apply
27
+ end
26
28
  end
27
29
  end
28
30
 
31
+ def progress_all(ignored_subjects = [])
32
+ progress(ignored_subjects) until @pending_pings.empty?
33
+ end
34
+
29
35
  def current_time
30
36
  @current_time ||= Time.now
31
37
  end
@@ -1,3 +1,3 @@
1
1
  module Dynflow
2
- VERSION = '0.8.32'
2
+ VERSION = '0.8.33'
3
3
  end
data/test/testing_test.rb CHANGED
@@ -166,6 +166,41 @@ module Dynflow
166
166
  end
167
167
  end
168
168
 
169
+ describe 'in thread executor with unrelated events in clock' do
170
+ class PollingAction < ::Dynflow::Action
171
+ def run(event = nil)
172
+ if output[:suspended].nil?
173
+ output[:suspended] = true
174
+ suspend do |action|
175
+ world.clock.ping(action, 1000, nil)
176
+ end
177
+ end
178
+ end
179
+ end
180
+
181
+ let :world do
182
+ WorldFactory.create_world(Dynflow::Testing::InThreadWorld)
183
+ end
184
+
185
+ let :execution_plan do
186
+ world.plan(PollingAction)
187
+ end
188
+
189
+ it 'processes unrelated events' do
190
+ q = Queue.new
191
+ 20.times { |i| world.clock.ping q, 0.0002, :periodic_check_inbox }
192
+
193
+ f = world.execute(execution_plan.id)
194
+
195
+ # This deadlocks the test
196
+ f.wait
197
+
198
+ f.value.tap do |plan|
199
+ plan.state.must_equal :stopped
200
+ end
201
+ end
202
+ end
203
+
169
204
  describe "in thread executor" do
170
205
  let :world do
171
206
  WorldFactory.create_world(Dynflow::Testing::InThreadWorld)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.32
4
+ version: 0.8.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Necas
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-10-30 00:00:00.000000000 Z
12
+ date: 2017-11-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json