From f732deea67e0ae75cf683942be5816d3f24005c4 Mon Sep 17 00:00:00 2001 From: Yevhenii Poberezhnyi Date: Wed, 11 Sep 2024 00:11:37 +0300 Subject: [PATCH] Fixed redis usage --- lib/taskinator/persistence.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/taskinator/persistence.rb b/lib/taskinator/persistence.rb index b97041d..0eb16e0 100644 --- a/lib/taskinator/persistence.rb +++ b/lib/taskinator/persistence.rb @@ -115,13 +115,13 @@ def persist_workflow_state(new_state) transaction.hmset( self.key, :state, new_state, - :updated_at, @updated_at + :updated_at, @updated_at.iso8601(3) ) # also update the "root" process transaction.hset( process_key, - :updated_at, @updated_at + :updated_at, @updated_at.iso8601(3) ) end end @@ -138,7 +138,7 @@ def fail(error=nil) :error_type, error.class.name, :error_message, error.message, :error_backtrace, JSON.generate(error.backtrace || []), - :updated_at, Time.now.utc + :updated_at, Time.now.utc.iso8601(3) ) end end @@ -182,7 +182,7 @@ def tasks_count process_key = self.process_key conn.multi do |transaction| transaction.hincrby process_key, "tasks_#{status}", 1 - transaction.hset process_key, :updated_at, Time.now.utc + transaction.hset process_key, :updated_at, Time.now.utc.iso8601(3) end end end @@ -294,7 +294,8 @@ def visit_attribute(attribute) end def visit_attribute_time(attribute) - visit_attribute(attribute) + value = @instance.send(attribute) + @hmset += [attribute, value.iso8601(3)] if value end def visit_attribute_enum(attribute, type)