quebert 0.0.9 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rbenv-version +1 -0
- data/Gemfile +6 -2
- data/README.rdoc +6 -2
- data/lib/quebert.rb +3 -2
- data/lib/quebert/job.rb +7 -4
- data/lib/quebert/timeout.rb +12 -0
- data/lib/quebert/version.rb +1 -1
- data/quebert.gemspec +0 -1
- metadata +8 -20
data/.rbenv-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ree-1.8.7-2011.03
|
data/Gemfile
CHANGED
@@ -3,9 +3,13 @@ source "http://rubygems.org"
|
|
3
3
|
# Specify your gem's dependencies in quebert.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
|
6
|
+
group :development do
|
7
|
+
gem 'system_timer', :require => false, :platform => :ruby_18
|
8
|
+
end
|
9
|
+
|
7
10
|
group :test do
|
8
|
-
gem 'ruby-debug'
|
11
|
+
gem 'ruby-debug', :platform => :ruby_18
|
12
|
+
gem 'ruby-debug19', :platform => :ruby_19
|
9
13
|
gem 'activerecord', '2.3.5'
|
10
14
|
gem 'sqlite3-ruby'
|
11
15
|
gem 'guard-rspec'
|
data/README.rdoc
CHANGED
@@ -2,9 +2,13 @@
|
|
2
2
|
|
3
3
|
async_observer is great, but is dated and doesn't really support running jobs outside of the async_send idiom. Quebert is an attempt to mix how jobs are run in other popular worker queue frameworks, like resque and dj, with async_observer so that you can have it both ways.
|
4
4
|
|
5
|
-
|
5
|
+
= Why Quebert (or how is it different from DJ and Resque)?
|
6
|
+
|
7
|
+
Because it has really low latency. Other Ruby queuing frameworks, like DJ or Resque, have to poll their queue servers periodicly. You could think of it as a "pull" queue. Quebert is a "push" queue. It maintains a persistent connection with beanstalkd and when is enqueud, its instantly pushed to the workers and executed.
|
6
8
|
|
7
|
-
|
9
|
+
= Who uses it?
|
10
|
+
|
11
|
+
Quebert is a serious project. Its used in a production environment at Poll Everywhere to handle everything from SMS message processing to account downgrades.
|
8
12
|
|
9
13
|
= Features
|
10
14
|
|
data/lib/quebert.rb
CHANGED
@@ -3,6 +3,8 @@ require 'quebert/version'
|
|
3
3
|
module Quebert
|
4
4
|
autoload :Serializer, 'quebert/serializer'
|
5
5
|
autoload :Configuration, 'quebert/configuration'
|
6
|
+
autoload :Timeout, 'quebert/timeout'
|
7
|
+
autoload :Logging, 'quebert/logging'
|
6
8
|
autoload :Job, 'quebert/job'
|
7
9
|
autoload :Controller, 'quebert/controller'
|
8
10
|
autoload :Backend, 'quebert/backend'
|
@@ -10,8 +12,7 @@ module Quebert
|
|
10
12
|
autoload :Worker, 'quebert/worker'
|
11
13
|
autoload :CommandLineRunner, 'quebert/command_line_runner'
|
12
14
|
autoload :AsyncSender, 'quebert/async_sender'
|
13
|
-
|
14
|
-
|
15
|
+
|
15
16
|
class << self
|
16
17
|
def configuration
|
17
18
|
@configuration ||= Configuration.new
|
data/lib/quebert/job.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'json'
|
2
|
-
require 'system_timer'
|
3
2
|
|
4
3
|
module Quebert
|
5
4
|
class Job
|
@@ -48,9 +47,13 @@ module Quebert
|
|
48
47
|
|
49
48
|
# Runs the perform method that somebody else should be implementing
|
50
49
|
def perform!
|
51
|
-
# Honor the timeout and kill the job
|
52
|
-
|
53
|
-
|
50
|
+
# Honor the timeout and kill the job in ruby-space. Beanstalk
|
51
|
+
# should be cleaning up this job and returning it to the queue
|
52
|
+
# as well.
|
53
|
+
begin
|
54
|
+
Quebert::Timeout.timeout(@ttr){ perform(*args) }
|
55
|
+
rescue ::Timeout::Error
|
56
|
+
raise Job::Timeout
|
54
57
|
end
|
55
58
|
end
|
56
59
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Setup a namespaced Quebert::Timeout class that will deal with responsible folks in
|
2
|
+
# 1.8.7 who use the SystemTimer gem.
|
3
|
+
module Quebert
|
4
|
+
Timeout = begin
|
5
|
+
require 'system_timer'
|
6
|
+
::SystemTimer
|
7
|
+
rescue LoadError
|
8
|
+
# Install the system_timer gem if you're running this in Ruby 1.8.7!
|
9
|
+
require 'timeout'
|
10
|
+
::Timeout
|
11
|
+
end
|
12
|
+
end
|
data/lib/quebert/version.rb
CHANGED
data/quebert.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quebert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
|
+
- 1
|
7
8
|
- 0
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 0.0.9
|
10
|
+
version: 1.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brad Gessler
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2011-11-
|
20
|
+
date: 2011-11-29 00:00:00 -08:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|
@@ -48,24 +48,10 @@ dependencies:
|
|
48
48
|
version: "0"
|
49
49
|
type: :runtime
|
50
50
|
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: system_timer
|
53
|
-
prerelease: false
|
54
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
|
-
requirements:
|
57
|
-
- - ">="
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
hash: 3
|
60
|
-
segments:
|
61
|
-
- 0
|
62
|
-
version: "0"
|
63
|
-
type: :runtime
|
64
|
-
version_requirements: *id003
|
65
51
|
- !ruby/object:Gem::Dependency
|
66
52
|
name: rspec
|
67
53
|
prerelease: false
|
68
|
-
requirement: &
|
54
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
69
55
|
none: false
|
70
56
|
requirements:
|
71
57
|
- - "="
|
@@ -77,7 +63,7 @@ dependencies:
|
|
77
63
|
- 0
|
78
64
|
version: 1.3.0
|
79
65
|
type: :development
|
80
|
-
version_requirements: *
|
66
|
+
version_requirements: *id003
|
81
67
|
description: A worker queue framework built around beanstalkd
|
82
68
|
email:
|
83
69
|
- brad@bradgessler.com
|
@@ -90,6 +76,7 @@ extra_rdoc_files: []
|
|
90
76
|
files:
|
91
77
|
- .document
|
92
78
|
- .gitignore
|
79
|
+
- .rbenv-version
|
93
80
|
- Gemfile
|
94
81
|
- Guardfile
|
95
82
|
- LICENSE
|
@@ -117,6 +104,7 @@ files:
|
|
117
104
|
- lib/quebert/support.rb
|
118
105
|
- lib/quebert/support/pid_file.rb
|
119
106
|
- lib/quebert/support/registry.rb
|
107
|
+
- lib/quebert/timeout.rb
|
120
108
|
- lib/quebert/version.rb
|
121
109
|
- lib/quebert/worker.rb
|
122
110
|
- quebert.gemspec
|