Project

throttler

0.0
No commit activity in last 3 years
No release in over 3 years
Throttler rate-limits code execution across threads or processes.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 0.9.2
 Project Readme

Throttler

[![travis] 1] 2

Throttler rate-limits code execution across threads, evented blocks, or processes on a server.

Mapplethorpe

Installation

Throttler works only on platforms that support file locking.

# Gemfile
gem 'throttler'

Usage

The following background job ensures workers will not scrape a site faster than once every second per IP address.

class Scrape
  def self.perform(site, ip_address, *ids)
    Throttler.limit 1.0, site, ip_address do
      spider = Spider.new site, ip_address
      spider.scrape *ids
    end
  end
end