Skip to content

Commit

Permalink
make compat checking more solid
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelmeurer committed Mar 10, 2024
1 parent 80b1473 commit 79783e4
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion app/services/compats/check_unchecked.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,39 @@ def call
.limit(LIMIT - count)
.each do |compat|

count += 1
next if check_failed?(compat)

begin
Compats::Check.call compat
rescue Compats::Check::Error => error
ReportError.call error
check_failed!(compat)
else
count += 1
end
end
end
end

private

def check_failed_cache_key(compat)
[
:compat_check_failed,
compat.id
].join(":")
end

def check_failed?(compat)
Kredis.redis.exists? \
check_failed_cache_key(compat)
end

def check_failed!(compat)
Kredis.redis.setex \
check_failed_cache_key(compat),
1.hour,
nil
end
end
end

0 comments on commit 79783e4

Please sign in to comment.