simpler_workflow 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -70,25 +70,28 @@ module SimplerWorkflow
70
70
  begin
71
71
  logger.info("Starting activity_loop for #{name}")
72
72
  domain.activity_tasks.poll(name.to_s) do |task|
73
- logger.info("Received task...")
74
- perform_task(task)
75
- unless task.responded?
76
- if next_activity
77
- result = {:next_activity => next_activity}.to_json
78
- task.complete!(:result => result)
79
- else
80
- task.complete!
73
+ begin
74
+ logger.info("Received task...")
75
+ perform_task(task)
76
+ unless task.responded?
77
+ if next_activity
78
+ result = {:next_activity => next_activity}.to_json
79
+ task.complete!(:result => result)
80
+ else
81
+ task.complete!
82
+ end
81
83
  end
84
+ rescue => e
85
+ context = {}
86
+ context[:activity_type] = [name.to_s, version]
87
+ context[:input] = task.input
88
+ context[:activity_id] = task.activity_id
89
+ SimplerWorkflow.exception_reporter.report(e, context)
90
+ task.fail! :reason => e.message, :details => { :failure_policy => :abort }.to_json unless task.responded?
82
91
  end
83
92
  end
84
93
  rescue Timeout::Error => e
85
- rescue => e
86
- context = {}
87
- context[:activity_type] = [name.to_s, version]
88
- context[:input] = task.input
89
- context[:activity_id] = task.activity_id
90
- SimplerWorkflow.exception_reporter.report(e, context)
91
- raise e
94
+ retry
92
95
  end
93
96
  end
94
97
  end
@@ -1,3 +1,3 @@
1
1
  module SimplerWorkflow
2
- VERSION = "0.1.10"
2
+ VERSION = "0.1.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simpler_workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-01 00:00:00.000000000 Z
12
+ date: 2012-10-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk