Skip to content

Instantly share code, notes, and snippets.

@scottwater
Created March 21, 2017 14:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottwater/93d78a127643c5d8a409a53958f0a332 to your computer and use it in GitHub Desktop.
Save scottwater/93d78a127643c5d8a409a53958f0a332 to your computer and use it in GitHub Desktop.
Sidekiq Push Bulk In
module Sidekiq
class Client
def self.push_bulk_in(interval, items)
int = interval.to_f
now = Time.now.to_f
ts = (int < 1_000_000_000 ? now + int : int)
items['at'.freeze] = ts if ts >= now
push_bulk(items)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment