ayl-beanstalk 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/ayl-beanstalk.gemspec +3 -3
- data/bin/ayl_beanstalk +14 -0
- data/lib/ayl-beanstalk/engine.rb +1 -1
- data/lib/ayl-beanstalk/worker.rb +5 -5
- metadata +114 -79
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.8
|
data/ayl-beanstalk.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "ayl-beanstalk"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.8"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["j0hnds@gmail.com"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2013-02-25"
|
13
13
|
s.description = "Ayl extension to provide beanstalk support."
|
14
14
|
s.email = "j0hnds@gmail.com"
|
15
15
|
s.executables = ["ayl_beanstalk", "ayl_worker", "ayl_worker_control"]
|
@@ -47,7 +47,7 @@ Gem::Specification.new do |s|
|
|
47
47
|
s.homepage = "http://github.com/j0hnds/ayl-beanstalk"
|
48
48
|
s.licenses = ["MIT"]
|
49
49
|
s.require_paths = ["lib"]
|
50
|
-
s.rubygems_version = "1.8.
|
50
|
+
s.rubygems_version = "1.8.23"
|
51
51
|
s.summary = "Ayl extension to provide beanstalk support."
|
52
52
|
|
53
53
|
if s.respond_to? :specification_version then
|
data/bin/ayl_beanstalk
CHANGED
@@ -134,6 +134,10 @@ class BeanstalkCommander
|
|
134
134
|
puts "Job was put"
|
135
135
|
end
|
136
136
|
|
137
|
+
def kill_worker
|
138
|
+
put_ayl_job 'Kernel.exit'
|
139
|
+
end
|
140
|
+
|
137
141
|
def put_ayl_job(job_body)
|
138
142
|
raise "Must specify a job body to put" unless job_body
|
139
143
|
puts "Putting (#{job_body}) on tube: #{@tube}"
|
@@ -163,6 +167,16 @@ class BeanstalkCommander
|
|
163
167
|
puts "Deleted job"
|
164
168
|
end
|
165
169
|
|
170
|
+
def eat_all_jobs
|
171
|
+
pool.watch(@tube)
|
172
|
+
while (!(job = pool.reserve(0)).nil?)
|
173
|
+
puts "Reserved job"
|
174
|
+
format_job(job)
|
175
|
+
job.delete
|
176
|
+
puts "Deleted job"
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
166
180
|
#
|
167
181
|
# General purpose tube cleaning mechanism. This allows you to move all the jobs
|
168
182
|
# from one tube to another within beanstalk.
|
data/lib/ayl-beanstalk/engine.rb
CHANGED
@@ -9,7 +9,7 @@ module Ayl
|
|
9
9
|
attr_reader :host, :port
|
10
10
|
|
11
11
|
def initialize(host='localhost', port=11300)
|
12
|
-
logger.
|
12
|
+
logger.debug "#{self.class.name}.initialize(#{host.inspect}, #{port})"
|
13
13
|
@host = host
|
14
14
|
@port = port
|
15
15
|
end
|
data/lib/ayl-beanstalk/worker.rb
CHANGED
@@ -7,13 +7,13 @@ module Ayl
|
|
7
7
|
include Ayl::Beanstalk::Pool
|
8
8
|
|
9
9
|
def initialize(host='localhost', port=11300)
|
10
|
-
logger.
|
10
|
+
logger.debug "#{self.class.name}.initialize(#{host.inspect}, #{port})"
|
11
11
|
@host = host
|
12
12
|
@port = port
|
13
13
|
end
|
14
14
|
|
15
15
|
def process_messages
|
16
|
-
logger.
|
16
|
+
logger.debug "#{self.class.name} entering process_messages loop watching: #{Ayl::MessageOptions.default_queue_name}"
|
17
17
|
# trap('TERM') { puts "## Got the term signal"; @stop = true }
|
18
18
|
# trap('INT') { puts "## Got the int signal"; @stop = true }
|
19
19
|
# Set the queue that we will be watching
|
@@ -36,12 +36,12 @@ module Ayl
|
|
36
36
|
raise
|
37
37
|
rescue Exception => ex
|
38
38
|
logger.error "#{self.class.name} Exception in process_messages: #{ex}\n#{ex.backtrace.join("\n")}"
|
39
|
-
logger.
|
39
|
+
logger.debug "Age of job: #{job.age}"
|
40
40
|
if job.age > 60
|
41
|
-
logger.
|
41
|
+
logger.debug "Deleting job"
|
42
42
|
job.delete
|
43
43
|
else
|
44
|
-
logger.
|
44
|
+
logger.debug "Decaying job"
|
45
45
|
job.decay
|
46
46
|
end
|
47
47
|
end
|
metadata
CHANGED
@@ -1,117 +1,155 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ayl-beanstalk
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.8
|
4
5
|
prerelease:
|
5
|
-
version: 0.1.7
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- j0hnds@gmail.com
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-02-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: ayl
|
17
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
22
21
|
version: 0.1.0
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements:
|
26
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.1.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
27
31
|
name: beanstalk-client
|
28
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
29
33
|
none: false
|
30
|
-
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
33
37
|
version: 1.1.0
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
|
-
version_requirements:
|
37
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.1.0
|
46
|
+
- !ruby/object:Gem::Dependency
|
38
47
|
name: daemons
|
39
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
40
49
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
44
53
|
version: 1.1.0
|
45
54
|
type: :runtime
|
46
55
|
prerelease: false
|
47
|
-
version_requirements:
|
48
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.1.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
49
63
|
name: rspec
|
50
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
51
65
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
55
69
|
version: 2.3.0
|
56
70
|
type: :development
|
57
71
|
prerelease: false
|
58
|
-
version_requirements:
|
59
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.3.0
|
78
|
+
- !ruby/object:Gem::Dependency
|
60
79
|
name: bundler
|
61
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
62
81
|
none: false
|
63
|
-
requirements:
|
64
|
-
- -
|
65
|
-
- !ruby/object:Gem::Version
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
66
85
|
version: 1.0.0
|
67
86
|
type: :development
|
68
87
|
prerelease: false
|
69
|
-
version_requirements:
|
70
|
-
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.0.0
|
94
|
+
- !ruby/object:Gem::Dependency
|
71
95
|
name: jeweler
|
72
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
73
97
|
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
77
101
|
version: 1.6.4
|
78
102
|
type: :development
|
79
103
|
prerelease: false
|
80
|
-
version_requirements:
|
81
|
-
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.6.4
|
110
|
+
- !ruby/object:Gem::Dependency
|
82
111
|
name: rcov
|
83
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
84
113
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version:
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
89
118
|
type: :development
|
90
119
|
prerelease: false
|
91
|
-
version_requirements:
|
92
|
-
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
93
127
|
name: pry
|
94
|
-
requirement:
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
95
129
|
none: false
|
96
|
-
requirements:
|
97
|
-
- -
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version:
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
100
134
|
type: :development
|
101
135
|
prerelease: false
|
102
|
-
version_requirements:
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
103
142
|
description: Ayl extension to provide beanstalk support.
|
104
143
|
email: j0hnds@gmail.com
|
105
|
-
executables:
|
144
|
+
executables:
|
106
145
|
- ayl_beanstalk
|
107
146
|
- ayl_worker
|
108
147
|
- ayl_worker_control
|
109
148
|
extensions: []
|
110
|
-
|
111
|
-
extra_rdoc_files:
|
149
|
+
extra_rdoc_files:
|
112
150
|
- LICENSE.txt
|
113
151
|
- README.rdoc
|
114
|
-
files:
|
152
|
+
files:
|
115
153
|
- .document
|
116
154
|
- .rspec
|
117
155
|
- Gemfile
|
@@ -138,34 +176,31 @@ files:
|
|
138
176
|
- spec/support/exit_code_matchers.rb
|
139
177
|
- spec/worker_spec.rb
|
140
178
|
homepage: http://github.com/j0hnds/ayl-beanstalk
|
141
|
-
licenses:
|
179
|
+
licenses:
|
142
180
|
- MIT
|
143
181
|
post_install_message:
|
144
182
|
rdoc_options: []
|
145
|
-
|
146
|
-
require_paths:
|
183
|
+
require_paths:
|
147
184
|
- lib
|
148
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
185
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
186
|
none: false
|
150
|
-
requirements:
|
151
|
-
- -
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
|
154
|
-
segments:
|
187
|
+
requirements:
|
188
|
+
- - ! '>='
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
191
|
+
segments:
|
155
192
|
- 0
|
156
|
-
|
157
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
193
|
+
hash: -880016066289096428
|
194
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
195
|
none: false
|
159
|
-
requirements:
|
160
|
-
- -
|
161
|
-
- !ruby/object:Gem::Version
|
162
|
-
version:
|
196
|
+
requirements:
|
197
|
+
- - ! '>='
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: '0'
|
163
200
|
requirements: []
|
164
|
-
|
165
201
|
rubyforge_project:
|
166
|
-
rubygems_version: 1.8.
|
202
|
+
rubygems_version: 1.8.23
|
167
203
|
signing_key:
|
168
204
|
specification_version: 3
|
169
205
|
summary: Ayl extension to provide beanstalk support.
|
170
206
|
test_files: []
|
171
|
-
|