lib/ruote/exp/ro_on_x.rb in ruote-2.3.0.1 vs lib/ruote/exp/ro_on_x.rb in ruote-2.3.0.2
- old
+ new
@@ -1,7 +1,7 @@
#--
-# Copyright (c) 2005-2012, John Mettraux, jmettraux@gmail.com
+# Copyright (c) 2005-2013, John Mettraux, jmettraux@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@@ -203,11 +203,13 @@
# :on_error => '5m: retry, pass'
#
def schedule_retries(handler, err)
retries = handler.split(/\s*,\s*/)
+
after, action = retries.shift.split(/:/)
+ (after, action = '0', after) if action.nil?
# deal with "* 3"
if m = action.match(/^ *([^ ]+) *\* *(\d+)$/)
@@ -297,10 +299,10 @@
handler = t
tree = h.supplanted['original_tree']
workitem = h.supplanted['applied_workitem']
end
- if on == 'on_error' && handler.respond_to?(:match) && handler.match(/:/)
+ if on == 'on_error' && handler.respond_to?(:match) && handler.match(/[,:\*]/)
return schedule_retries(handler, err)
end
new_tree = case handler
when Hash then handler['tree']