Skip to content

Instantly share code, notes, and snippets.

@scicco
Last active February 27, 2017 14:06
Show Gist options
  • Select an option

  • Save scicco/080fe0b4be8fa0e79d2e4e3d3a5926db to your computer and use it in GitHub Desktop.

Select an option

Save scicco/080fe0b4be8fa0e79d2e4e3d3a5926db to your computer and use it in GitHub Desktop.
10 minutes expiration for sidekiq_status items
#USE THIS INSIDE RAILS CONSOLE
cursor = 0
items = []
while(cursor != -1)
result = $redis.scan(cursor, match: "sidekiq:sidekiq:status*")
cursor = result[0].to_i
items += result[1]
puts cursor
if cursor == 0
cursor = -1
end
end
puts items.size
#item = items.first
max_expiration = 60 * 10
items.each do |item|
ttl = $redis.ttl(item)
$redis.expire(item, max_expiration) if ttl > max_expiration
end; nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment