lib/dirty_pipeline/event.rb in dirty_pipeline-0.7.1 vs lib/dirty_pipeline/event.rb in dirty_pipeline-0.8.1
- old
+ new
@@ -1,6 +1,7 @@
require 'json'
+require 'time'
module DirtyPipeline
class Event
NEW = "new".freeze
START = "started".freeze
@@ -39,11 +40,11 @@
@data = {
"uuid" => @id,
"transaction_uuid" => @tx_id,
"transition" => transition,
"args" => args,
- "created_at" => Time.now,
+ "created_at" => Time.now.utc.iso8601,
"cache" => {},
"attempts_count" => 1,
"status" => NEW,
}.merge(data_hash)
@error = error
@@ -69,28 +70,28 @@
def link_exception(exception)
@error = {
"exception" => exception.class.to_s,
"exception_message" => exception.message,
- "created_at" => Time.now,
+ "created_at" => Time.now.utc.iso8601,
}
failure!
end
def attempts_count
@data["attempts_count"].to_i
end
def attempt_retry!
- @data["updated_at"] = Time.now
+ @data["updated_at"] = Time.now.utc.iso8601
@data["attempts_count"] = attempts_count + 1
end
def complete(changes, destination)
@data.merge!(
"destination" => destination,
"changes" => changes,
- "updated_at" => Time.now,
+ "updated_at" => Time.now.utc.iso8601,
"status" => SUCCESS,
)
end
end
end