weel 1.99.89 → 1.99.94

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/weel.rb +29 -11
  3. data/weel.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51411a60466b7ea131d02acbd61604a59b6b4e9fb967a332994c05b29f1fd9ee
4
- data.tar.gz: 8d46c4fcf72ca24891af272e42ae2d57ce478e6c6b3a08c47c0b6d396d6b2cb0
3
+ metadata.gz: 5c6ec72184bb20d41fdef30320134806cf5f450a3a141efe9bde5adf6f24c44d
4
+ data.tar.gz: 2732e2b2ad2ec01d554b1b7c94c06a831d5d69ca36404c3c35ad9605cd9f444d
5
5
  SHA512:
6
- metadata.gz: '09eafb6debb82a7074aee19dc19be90d8a29af8dd1209d8a9475097126e6feefc66f8412cd6cb909c0652e7cd3fe5b50327e5ecc21cabc12f244846ffbc33e43'
7
- data.tar.gz: 4128bfe0ce21234534afdc05069ce3b42c8cff7a384bd6ac938c992f9d418534d224ae2f29a38cc932e4c5df99346907324cd74e8c9b6562315b2e8b097636f0
6
+ metadata.gz: c77da26f6558eec836f5479a0bee9b9f9a62b11fd68e6ecc2002b52f40eabd999dae7118f6ff6f1979953d94abebb33c7f4ec47650c0d78f1cd5e1b7e1cd34b9
7
+ data.tar.gz: 3d8209e7eae538b910c3ac0d0c7a7f401b601aae696e956262dc5605e56832201071fbf0277468f9f8ffa95e51933fb8acc45b1b2d8da04be0c21d5998075bd2
@@ -15,6 +15,7 @@
15
15
  # <http://www.gnu.org/licenses/>.
16
16
 
17
17
  require 'thread'
18
+ require 'securerandom'
18
19
 
19
20
  class WEEL
20
21
  def initialize(*args)# {{{
@@ -237,6 +238,7 @@ class WEEL
237
238
  end # }}}
238
239
 
239
240
  class HandlerWrapperBase # {{{
241
+ def self::loop_guard(arguments,lid,count); false; end
240
242
  def self::inform_state_change(arguments,newstate); end
241
243
  def self::inform_syntax_error(arguments,err,code); end
242
244
  def self::inform_handlerwrapper_error(arguments,err); end
@@ -297,6 +299,12 @@ class WEEL
297
299
  def to_json(*args)
298
300
  as_json.to_json(*args)
299
301
  end
302
+ def eql?(other)
303
+ to_s == other.to_s
304
+ end
305
+ def hash
306
+ to_s.hash
307
+ end
300
308
  end # }}}
301
309
 
302
310
  class Continue # {{{
@@ -584,15 +592,21 @@ class WEEL
584
592
  __weel_sim_stop(:loop,hw,pos,args.merge(:testing=>condition[1],:condition=>cond))
585
593
  return
586
594
  end
595
+ loop_guard = 0
596
+ loop_id = SecureRandom.uuid
587
597
  catch :escape do
588
598
  case condition[1]
589
599
  when :pre_test
590
600
  while __weel_eval_condition(condition[0]) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing
601
+ loop_guard += 1
591
602
  __weel_protect_yield(&block)
603
+ sleep 1 if @__weel_handlerwrapper::loop_guard(@__weel_handlerwrapper_args,loop_id,loop_guard)
592
604
  end
593
605
  when :post_test
594
606
  begin
607
+ loop_guard += 1
595
608
  __weel_protect_yield(&block)
609
+ sleep 1 if @__weel_handlerwrapper::loop_guard(@__weel_handlerwrapper_args,loop_id,loop_guard)
596
610
  end while __weel_eval_condition(condition[0]) && self.__weel_state != :stopping && self.__weel_state != :stopped && self.__weel_state != :finishing
597
611
  end
598
612
  end
@@ -622,7 +636,7 @@ class WEEL
622
636
  searchmode = __weel_is_in_search_mode(position)
623
637
  return if searchmode
624
638
  return if self.__weel_state == :stopping || self.__weel_state == :finishing || self.__weel_state == :stopped || Thread.current[:nolongernecessary]
625
- __weel_progress searchmode, position, true
639
+ __weel_progress position, true
626
640
  self.__weel_state = :stopping
627
641
  end #}}}
628
642
 
@@ -667,8 +681,9 @@ class WEEL
667
681
  end
668
682
  end #}}}
669
683
 
670
- def __weel_progress(searchmode, position, skip=false) #{{{
684
+ def __weel_progress(position, skip=false) #{{{
671
685
  ipc = {}
686
+ branch = Thread.current
672
687
  if Thread.current[:branch_parent] && Thread.current[:branch_parent][:branch_position]
673
688
  @__weel_positions.delete Thread.current[:branch_parent][:branch_position]
674
689
  ipc[:unmark] ||= []
@@ -680,14 +695,21 @@ class WEEL
680
695
  ipc[:unmark] ||= []
681
696
  ipc[:unmark] << Thread.current[:branch_position] rescue nil
682
697
  end
683
- wp = WEEL::Position.new(position, skip ? :after : :at, nil)
698
+ wp = if branch[:branch_search_now] == true
699
+ branch[:branch_search_now] = false
700
+ WEEL::Position.new(position, skip ? :after : :at, @__weel_search_positions[position]&.passthrough)
701
+ else
702
+ WEEL::Position.new(position, skip ? :after : :at)
703
+ end
684
704
  ipc[skip ? :after : :at] = [wp]
685
705
 
706
+ @__weel_search_positions.delete(position)
686
707
  @__weel_search_positions.each do |k,ele| # some may still be in active search but lets unmark them for good measure
687
708
  ipc[:unmark] ||= []
688
709
  ipc[:unmark] << ele
689
710
  true
690
711
  end
712
+ ipc[:unmark].uniq! if ipc[:unmark]
691
713
 
692
714
  @__weel_positions << wp
693
715
  Thread.current[:branch_position] = wp
@@ -711,7 +733,7 @@ class WEEL
711
733
  return
712
734
  end
713
735
 
714
- wp = __weel_progress searchmode, position
736
+ wp = __weel_progress position
715
737
 
716
738
  # searchmode position is after, jump directly to vote_sync_after
717
739
  raise Signal::Proceed if searchmode == :after
@@ -757,13 +779,7 @@ class WEEL
757
779
  raise Signal::Stop unless handlerwrapper.vote_sync_before(params)
758
780
  raise Signal::Skip if self.__weel_state == :stopping || self.__weel_state == :finishing
759
781
 
760
- if @__weel_search_positions[position]
761
- passthrough = @__weel_search_positions[position].passthrough
762
- @__weel_search_positions[position].passthrough = nil
763
- else
764
- passthrough = nil
765
- end
766
- handlerwrapper.activity_handle passthrough, params
782
+ handlerwrapper.activity_handle wp.passthrough, params
767
783
  wp.passthrough = handlerwrapper.activity_passthrough_value
768
784
  unless wp.passthrough.nil?
769
785
  @__weel_handlerwrapper::inform_position_change @__weel_handlerwrapper_args, :wait => [wp]
@@ -908,9 +924,11 @@ class WEEL
908
924
 
909
925
  if position && @__weel_search_positions.include?(position) # matching searchpos => start execution from here
910
926
  branch[:branch_search] = false # execute all activities in THIS branch (thread) after this point
927
+ branch[:branch_search_now] = true # just now did we switch the search mode
911
928
  while branch.key?(:branch_parent) # also all parent branches should execute activities after this point, additional branches spawned by parent branches should still be in search mode
912
929
  branch = branch[:branch_parent]
913
930
  branch[:branch_search] = false
931
+ branch[:branch_search_now] = true # just now did we switch the search mode
914
932
  end
915
933
  @__weel_search_positions[position].detail == :after
916
934
  else
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "weel"
3
- s.version = "1.99.89"
3
+ s.version = "1.99.94"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "Workflow Execution Engine Library (WEEL)"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.99.89
4
+ version: 1.99.94
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-09-23 00:00:00.000000000 Z
12
+ date: 2020-09-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit