Sha256: c28e659c9c980cb4ca76984855802fdd829ae1c78e3c4aade5b9c085f872e316
Contents?: true
Size: 730 Bytes
Versions: 21
Compression:
Stored size: 730 Bytes
Contents
class LeakyBucketWorker @queue = :rate_limits class << self def perform(emails, access_token) Resque.logger.info('Sleep 0.2 seconds to avoid 429 error') sleep(0.2) response = create_contacts(emails, access_token) remove_contacts(response.results.map(&:id), access_token) end private def create_contacts(emails, access_token) response = Services::Hubspot::Contacts::CreateBatch.new(emails, access_token).call Resque.logger.info("Created contacts: #{emails}") response end def remove_contacts(ids, access_token) Services::Hubspot::Contacts::ArchiveBatch.new(ids, access_token).call Resque.logger.info("Removed contacts: #{ids}") end end end
Version data entries
21 entries across 21 versions & 1 rubygems