dirty_pipeline 0.8.2 → 0.8.3
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 +4 -4
- data/lib/dirty_pipeline/base.rb +4 -3
- data/lib/dirty_pipeline/event.rb +5 -2
- data/lib/dirty_pipeline/pg/railway.rb +4 -4
- data/lib/dirty_pipeline/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c994b31257ebb9f48ae2c67ce0d197027f9397ad407944d9f938dabf80dbbe58
|
4
|
+
data.tar.gz: 16684ec82ac970097e7add8f2a80e4d45d929d118d0cd88ef8e3584c3f478df0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99ef4a8cc4ce384654c8fc90c1b5bec987955512c942c0c82bac630034e02f8df2ad26ef03f7f7dab961456b24399f6adaa443ccbcf50a0f9a858ea82f5aeb2f
|
7
|
+
data.tar.gz: 8482d89667c2ba8906fe553928c37e969256b1db6be91b25364d7d1f1ab5cf253fc8fc5f6ad15e8ef81afc30ba8b07a839ada7d46056571a21d4b0f1aa29e155
|
data/lib/dirty_pipeline/base.rb
CHANGED
@@ -131,8 +131,9 @@ module DirtyPipeline
|
|
131
131
|
# dispatch event?
|
132
132
|
Transaction.new(self, event).call do |destination, action, *args|
|
133
133
|
state_changes = process_action(action, event, *args)
|
134
|
+
event.assign_changes(state_changes)
|
134
135
|
next if status.failure?
|
135
|
-
Success(event,
|
136
|
+
Success(event, destination)
|
136
137
|
end
|
137
138
|
call_next
|
138
139
|
|
@@ -176,8 +177,8 @@ module DirtyPipeline
|
|
176
177
|
@status = Status.failure(cause, tag: type)
|
177
178
|
end
|
178
179
|
|
179
|
-
def Success(event,
|
180
|
-
event.complete(
|
180
|
+
def Success(event, destination)
|
181
|
+
event.complete(destination)
|
181
182
|
@status = Status.success(subject)
|
182
183
|
end
|
183
184
|
end
|
data/lib/dirty_pipeline/event.rb
CHANGED
@@ -86,10 +86,13 @@ module DirtyPipeline
|
|
86
86
|
@data["attempts_count"] = attempts_count + 1
|
87
87
|
end
|
88
88
|
|
89
|
-
def
|
89
|
+
def assign_changes(changes)
|
90
|
+
@data["changes"] = changes
|
91
|
+
end
|
92
|
+
|
93
|
+
def complete(destination)
|
90
94
|
@data.merge!(
|
91
95
|
"destination" => destination,
|
92
|
-
"changes" => changes,
|
93
96
|
"updated_at" => Time.now.utc.iso8601,
|
94
97
|
"status" => SUCCESS,
|
95
98
|
)
|
@@ -81,9 +81,9 @@ module DirtyPipeline
|
|
81
81
|
return if name.to_s == active
|
82
82
|
|
83
83
|
with_postgres do |c|
|
84
|
-
c.exec('START TRANSACTION;')
|
84
|
+
# c.exec('START TRANSACTION;')
|
85
85
|
c.exec(SWITCH_OPERATION, [active_operation_key, name])
|
86
|
-
c.exec('COMMIT;')
|
86
|
+
# c.exec('COMMIT;')
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -133,9 +133,9 @@ module DirtyPipeline
|
|
133
133
|
def start_transaction!
|
134
134
|
switch_to(DEFAULT_OPERATIONS.first) unless active
|
135
135
|
with_postgres do |c|
|
136
|
-
c.exec('START TRANSACTION;')
|
136
|
+
# c.exec('START TRANSACTION;')
|
137
137
|
c.exec(SWITCH_TRANSACTION, [active_transaction_key, @tx_id])
|
138
|
-
c.exec('COMMIT;')
|
138
|
+
# c.exec('COMMIT;')
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|