lib/metacrunch/redis/queue_writer.rb in metacrunch-3.1.3 vs lib/metacrunch/redis/queue_writer.rb in metacrunch-3.1.4

- old
+ new

@@ -15,10 +15,18 @@ redis_connection_or_url end end def write(data) - @redis.rpush(@queue_name, data.to_json) + @redis.rpush(@queue_name, data) + rescue RuntimeError => e + if e.message =~ /maxmemory/ + puts "Redis has reached maxmemory. Waiting 10 seconds and trying again..." + sleep(10) + retry + else + raise e + end end def close if @redis @redis.bgsave if @save_on_close