Skip to content

Commit 8d6f10b

Browse files
committed
first cut
0 parents  commit 8d6f10b

File tree

9 files changed

+126
-0
lines changed

9 files changed

+126
-0
lines changed

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
*.gem
2+
*.rbc
3+
.bundle
4+
.config
5+
.yardoc
6+
Gemfile.lock
7+
InstalledFiles
8+
_yardoc
9+
coverage
10+
doc/
11+
lib/bundler/man
12+
pkg
13+
rdoc
14+
spec/reports
15+
test/tmp
16+
test/version_tmp
17+
tmp

Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'rake'
4+
# Specify your gem's dependencies in resque-round-robin.gemspec
5+
gemspec
6+

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (c) 2012 Eddy Kim
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the
7+
"Software"), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following conditions:
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Resque-round-robin
2+
==================
3+
4+
A plugin for Resque that implements round-robin behavior for workers.
5+
6+
The standard behavior for Resque workers is to pull a job off a queue,
7+
and continue until the queue is empty. Once empty, the worker moves
8+
on to the next queue (if available).
9+
10+
For our situation, which is probably pretty rare in rails deployments,
11+
we have multiple customers who submit jobs to resque, and we need to
12+
keep the jobs of one customer from starving out other customers.
13+
14+
Using resque-dynamic-queues in conjunction with this gem, we are able to
15+
support this requirement of fairness, where not more than one worker will
16+
process each customers job.
17+
18+
19+
## Installation
20+
21+
Add this line to your application's Gemfile:
22+
23+
gem 'resque-round-robin'
24+
25+
And then execute:
26+
27+
$ bundle
28+
29+
## Usage
30+
31+
TODO: Write usage instructions here
32+
33+
## Contributing
34+
35+
1. Fork it
36+
2. Create your feature branch (`git checkout -b my-new-feature`)
37+
3. Commit your changes (`git commit -am 'Added some feature'`)
38+
4. Push to the branch (`git push origin my-new-feature`)
39+
5. Create new Pull Request

Rakefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env rake
2+
require "bundler/gem_tasks"

lib/resque-round-robin.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
require 'resque'
3+
require "resque/plugins/round-robin/version"
4+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
module Resque
3+
module Plugins
4+
module RoundRobin
5+
6+
end
7+
end
8+
end
9+
10+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module Resque
2+
module Plugins
3+
module RoundRobin
4+
VERSION = "0.0.1"
5+
end
6+
end
7+
end

resque-round-robin.gemspec

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -*- encoding: utf-8 -*-
2+
require File.expand_path('../lib/resque/plugins/round_robin/version', __FILE__)
3+
4+
Gem::Specification.new do |gem|
5+
gem.authors = ["Eddy Kim"]
6+
gem.email = ["[email protected]"]
7+
gem.description = %q{A Resque round-robin plugin}
8+
gem.summary = %q{A Resque plugin to modify the worker behavior to pull jobs off queues, round-robin}
9+
gem.homepage = ""
10+
11+
gem.add_dependency "resque"
12+
13+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
14+
gem.files = `git ls-files`.split("\n")
15+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16+
gem.name = "resque-round-robin"
17+
gem.require_paths = ["lib"]
18+
gem.version = Resque::Plugins::RoundRobin::VERSION
19+
end

0 commit comments

Comments
 (0)