Skip to content

Commit 661e3b5

Browse files
committed
fix: rescue error from sideloads updated_at calculation, defaulting to the current time
1 parent dcee71b commit 661e3b5

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lib/graphiti/scope.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,17 @@ def cache_key_with_version
9292
end
9393

9494
def updated_at
95-
updated_ats = sideload_resource_proxies.map(&:updated_at)
96-
95+
updated_time = nil
9796
begin
97+
updated_ats = sideload_resource_proxies.map(&:updated_at)
9898
updated_ats << @object.maximum(:updated_at)
99+
updated_time = updated_ats.compact.max
99100
rescue => e
100-
Graphiti.log("error calculating last_modified_at for #{@resource.class}")
101+
Graphiti.log(["error calculating last_modified_at for #{@resource.class}", :red])
101102
Graphiti.log(e)
102103
end
103104

104-
updated_ats.compact.max
105+
return updated_time || Time.now
105106
end
106107
alias_method :last_modified_at, :updated_at
107108

0 commit comments

Comments
 (0)