Skip to content

Commit

Permalink
fix: rescue error from sideloads updated_at calculation, defaulting t…
Browse files Browse the repository at this point in the history
…o the current time
  • Loading branch information
jkeen committed Apr 17, 2024
1 parent dcee71b commit 661e3b5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/graphiti/scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,17 @@ def cache_key_with_version
end

def updated_at
updated_ats = sideload_resource_proxies.map(&:updated_at)

updated_time = nil
begin
updated_ats = sideload_resource_proxies.map(&:updated_at)
updated_ats << @object.maximum(:updated_at)
updated_time = updated_ats.compact.max
rescue => e
Graphiti.log("error calculating last_modified_at for #{@resource.class}")
Graphiti.log(["error calculating last_modified_at for #{@resource.class}", :red])
Graphiti.log(e)
end

updated_ats.compact.max
return updated_time || Time.now
end
alias_method :last_modified_at, :updated_at

Expand Down

0 comments on commit 661e3b5

Please # to comment.