dynflow 1.8.3 → 1.8.4

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: b735fbb2453eb09dbab54199dae5cb8c453136bbee0fda91469372f72b9e776f
4
- data.tar.gz: 2a8318ae444f8330ed116ca278156f92e9003804bbaffc025003a567891974f4
3
+ metadata.gz: 2bf4beeafa28798576c07fd3fcabd039c026bee7457270426152c6a80be5b86a
4
+ data.tar.gz: 2ff9ad272fa222d27f4103188b98809edbe150e92ce18a573442215d8cc06b57
5
5
  SHA512:
6
- metadata.gz: 74bd6c057a5b6398adca1e3aef5f0b304899c070f11abf02b404df3f19ea479a9b18934939798867bfb0d39c6226c605f621600b3466dd1f2f1e34dc44a1cf7c
7
- data.tar.gz: a462206856f16910092683641f1e7fa721714f3da7b821b86811a95073b2cc860a1ac082e42de9f4913317ef2e72e8d759cd63f9dcbd9604c62036f0c59527aa
6
+ metadata.gz: cb049c6b32cf7a84bce0e616c64648ab13fecbb131233f7ae9a64b5308f3961cee00786b2ca0794bb764a2d42b488a4014b52da5d8de632887834230638e8145
7
+ data.tar.gz: 4dd52c5e4c1e8644be534a0e48209c17a12ee03c358d81fdefd52b884b8d3b96c2f89417e46790544f68fe80a3004d209a12f2d0954393bb6dd65a4e82b6579e
@@ -145,6 +145,10 @@ module Dynflow
145
145
  raise "Can't acquire the lock after deserialization" if @from_hash
146
146
  Type! owner_id, String
147
147
  end
148
+
149
+ def unlock_on_shutdown?
150
+ true
151
+ end
148
152
  end
149
153
 
150
154
  class LockByWorld < Lock
@@ -289,6 +293,10 @@ module Dynflow
289
293
  def request_id
290
294
  @data[:request_id]
291
295
  end
296
+
297
+ def unlock_on_shutdown?
298
+ false
299
+ end
292
300
  end
293
301
 
294
302
  class PlanningLock < LockByWorld
@@ -305,6 +313,10 @@ module Dynflow
305
313
  def execution_plan_id
306
314
  @data[:execution_plan_id]
307
315
  end
316
+
317
+ def unlock_on_shutdown?
318
+ false
319
+ end
308
320
  end
309
321
 
310
322
  attr_reader :adapter
@@ -320,8 +332,12 @@ module Dynflow
320
332
  if block
321
333
  begin
322
334
  block.call
335
+ # We are looking for ::Sidekiq::Shutdown, but that may not be defined. We rely on it being a subclass of Interrupt
336
+ # We don't really want to rescue it, but we need to bind it somehow so that we can check it in ensure
337
+ rescue Interrupt => e
338
+ raise e
323
339
  ensure
324
- release(lock)
340
+ release(lock) if !(defined?(::Sidekiq) && e.is_a?(::Sidekiq::Shutdown)) || lock.unlock_on_shutdown?
325
341
  end
326
342
  end
327
343
  rescue DuplicateRecordError => e
@@ -333,8 +349,8 @@ module Dynflow
333
349
  adapter.delete_record(lock)
334
350
  end
335
351
 
336
- def release_by_owner(owner_id)
337
- find_locks(owner_id: owner_id).map { |lock| release(lock) }
352
+ def release_by_owner(owner_id, on_termination = false)
353
+ find_locks(owner_id: owner_id).map { |lock| release(lock) if !on_termination || lock.unlock_on_shutdown? }
338
354
  end
339
355
 
340
356
  def find_locks(filter_options)
@@ -379,9 +395,9 @@ module Dynflow
379
395
  create_record(world)
380
396
  end
381
397
 
382
- def delete_world(world)
398
+ def delete_world(world, on_termination = false)
383
399
  Type! world, Coordinator::ClientWorld, Coordinator::ExecutorWorld
384
- release_by_owner("world:#{world.id}")
400
+ release_by_owner("world:#{world.id}", on_termination)
385
401
  delete_record(world)
386
402
  end
387
403
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dynflow
4
- VERSION = '1.8.3'
4
+ VERSION = '1.8.4'
5
5
  end
@@ -117,7 +117,14 @@ module Dynflow
117
117
  # @return [Integer] number of invalidated worlds
118
118
  def perform_validity_checks
119
119
  world_invalidation_result = worlds_validity_check
120
- locks_validity_check
120
+ locks_validity_check.each do |lock|
121
+ case lock
122
+ when ::Dynflow::Coordinator::PlanningLock
123
+ invalidate_planning_lock(lock)
124
+ when ::Dynflow::Coordinator::ExecutionLock
125
+ invalidate_execution_lock(lock)
126
+ end
127
+ end
121
128
  pruned = connector.prune_undeliverable_envelopes(self)
122
129
  logger.error("Pruned #{pruned} undeliverable envelopes") unless pruned.zero?
123
130
  world_invalidation_result.values.select { |result| result == :invalidated }.size
data/lib/dynflow/world.rb CHANGED
@@ -344,7 +344,7 @@ module Dynflow
344
344
  clock.ask(:terminate!).wait(termination_timeout)
345
345
  end
346
346
 
347
- coordinator.delete_world(registered_world)
347
+ coordinator.delete_world(registered_world, true)
348
348
  @terminated.resolve
349
349
  true
350
350
  rescue => e
data/lib/dynflow.rb CHANGED
@@ -25,7 +25,7 @@ module Dynflow
25
25
  # @return [Dynflow::World, nil]
26
26
  def process_world
27
27
  return @process_world if defined? @process_world
28
- @process_world = Sidekiq.configure_server { |c| c.options[:dynflow_world] }
28
+ @process_world = Sidekiq.configure_server { |c| c[:dynflow_world] }
29
29
  raise "process world is not set" unless @process_world
30
30
  @process_world
31
31
  end
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: 1.8.3
4
+ version: 1.8.4
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: 2024-03-05 00:00:00.000000000 Z
12
+ date: 2024-05-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: algebrick
@@ -682,7 +682,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
682
682
  - !ruby/object:Gem::Version
683
683
  version: '0'
684
684
  requirements: []
685
- rubygems_version: 3.1.2
685
+ rubygems_version: 3.3.26
686
686
  signing_key:
687
687
  specification_version: 4
688
688
  summary: DYNamic workFLOW engine