lib/legion/extensions/tasker/helpers/fetch_delayed.rb in lex-tasker-0.2.0 vs lib/legion/extensions/tasker/helpers/fetch_delayed.rb in lex-tasker-0.2.1
- old
+ new
@@ -30,11 +30,11 @@
INNER JOIN legion.runners ON (runners.id = functions.runner_id)
INNER JOIN `legion`.`extensions` ON (`runners`.`extension_id` = `extensions`.`id`)
LEFT JOIN legion.relationships ON (relationships.id = tasks.relationship_id)
WHERE status = \'task.delayed\';'
- Legion::Data::Connection.sequel.fetch(sql)
+ Legion::Data::Connection.sequel.fetch(sql).all
end
def find_subtasks(trigger_id:, **)
sql = "
SELECT
@@ -53,11 +53,11 @@
"
cache = Legion::Cache.get(sql)
return cache unless cache.nil?
- results = Legion::Data::Connection.sequel.fetch(sql)
- Legion::Cache.set(sql, results, ttl: 5) if results.is_a?(Hash) && results.count.positive?
+ results = Legion::Data::Connection.sequel.fetch(sql).all
+ Legion::Cache.set(sql, results, 5) if results.is_a?(Array) && results.count.positive?
results
end
end
end
end