beanstalkd_view 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/Gemfile +2 -0
- data/README.md +12 -3
- data/Rakefile +18 -12
- data/lib/beanstalkd_view/beanstalkd_utils.rb +65 -3
- data/lib/beanstalkd_view/resources/js/peek_jobs.js +3 -1
- data/lib/beanstalkd_view/resources/js/peek_range.js +3 -3
- data/lib/beanstalkd_view/server.rb +42 -133
- data/lib/beanstalkd_view/version.rb +1 -1
- data/lib/beanstalkd_view/views/index.erb +68 -57
- data/lib/beanstalkd_view/views/peek_range.erb +6 -4
- data/lib/beanstalkd_view/views/tube_stats.erb +21 -21
- data/lib/beanstalkd_view.rb +1 -2
- data/spec/integration/sinatra_integration_spec.rb +0 -1
- data/spec/lib/beanstalkd_view/beanstalkd_util_spec.rb +0 -10
- data/spec/rails_app/log/test.log +1762 -8515
- data/spec/spec_helper.rb +11 -0
- data/spec/support/integration_test_shared_examples.rb +8 -7
- metadata +8 -11
- data/lib/beanstalkd_view/Gemfile +0 -4
- data/lib/beanstalkd_view/Rakefile +0 -1
- data/lib/beanstalkd_view/extensions/beanstalk-pool.rb +0 -39
data/spec/spec_helper.rb
CHANGED
@@ -18,5 +18,16 @@ end
|
|
18
18
|
RSpec.configure do |config|
|
19
19
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
20
20
|
config.filter_run_excluding :requires_beanstalkd, :requires_two_beanstalkd
|
21
|
+
|
22
|
+
config.before(:each) do
|
23
|
+
requires_two_beanstalkd = example.options[:requires_two_beanstalkd]
|
24
|
+
if requires_two_beanstalkd
|
25
|
+
ENV['BEANSTALK_URL'] = 'beanstalk://localhost:11300,beanstalk://localhost:11400'
|
26
|
+
else
|
27
|
+
ENV['BEANSTALK_URL'] = 'beanstalk://localhost:11300'
|
28
|
+
end
|
29
|
+
end
|
21
30
|
end
|
22
31
|
|
32
|
+
|
33
|
+
|
@@ -10,7 +10,7 @@ shared_examples 'integration_test' do
|
|
10
10
|
|
11
11
|
it "should show error at site root" do
|
12
12
|
visit site_root
|
13
|
-
page.should have_content "
|
13
|
+
page.should have_content "Could not connect"
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -43,7 +43,7 @@ shared_examples 'integration_test' do
|
|
43
43
|
form.click_link('Add Job')
|
44
44
|
body.should have_content "Add new job?"
|
45
45
|
click_link "confirm_add_job_btn"
|
46
|
-
body.should have_content "Added job
|
46
|
+
body.should have_content "Added job:"
|
47
47
|
end
|
48
48
|
|
49
49
|
it "show be able to click on the test.tube link (created by the last test)", :js => true do
|
@@ -60,9 +60,7 @@ shared_examples 'integration_test' do
|
|
60
60
|
click_button 'Peek'
|
61
61
|
body.should have_content "Peek Range"
|
62
62
|
end
|
63
|
-
|
64
|
-
=begin
|
65
|
-
# Current beanstalk-client lib doesn't support pause_tube action
|
63
|
+
|
66
64
|
it "show be able to pause a tube", :js => true do
|
67
65
|
visit "#{site_root}/tube/test.tube"
|
68
66
|
form = find('#pause_form')
|
@@ -70,7 +68,6 @@ shared_examples 'integration_test' do
|
|
70
68
|
click_button "Pause"
|
71
69
|
body.should have_content "Paused test.tube"
|
72
70
|
end
|
73
|
-
=end
|
74
71
|
|
75
72
|
it "show be able to kick a tube", :js => true do
|
76
73
|
visit "#{site_root}tube/test.tube"
|
@@ -110,11 +107,15 @@ shared_examples 'integration_test' do
|
|
110
107
|
form.click_link('Add Job')
|
111
108
|
body.should have_content "Add new job?"
|
112
109
|
click_link "confirm_add_job_btn"
|
113
|
-
body.should have_content "Added job
|
110
|
+
body.should have_content "Added job:"
|
114
111
|
|
115
112
|
visit site_root
|
116
113
|
click_link('test.tube')
|
117
114
|
body.should have_content "test.tube"
|
115
|
+
|
116
|
+
visit "#{site_root}tube/test.tube"
|
117
|
+
click_link('peek_ready_btn')
|
118
|
+
body.should have_content "Job id:"
|
118
119
|
end
|
119
120
|
end
|
120
121
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beanstalkd_view
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -60,21 +60,21 @@ dependencies:
|
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.0.11
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: beaneater
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
69
|
+
version: 0.1.0
|
70
70
|
type: :runtime
|
71
71
|
prerelease: false
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ~>
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
77
|
+
version: 0.1.0
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
79
|
name: vegas
|
80
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,9 +201,6 @@ files:
|
|
201
201
|
- Rakefile
|
202
202
|
- MIT-LICENSE.txt
|
203
203
|
- lib/beanstalkd_view/beanstalkd_utils.rb
|
204
|
-
- lib/beanstalkd_view/extensions/beanstalk-pool.rb
|
205
|
-
- lib/beanstalkd_view/Gemfile
|
206
|
-
- lib/beanstalkd_view/Rakefile
|
207
204
|
- lib/beanstalkd_view/resources/css/app.css
|
208
205
|
- lib/beanstalkd_view/resources/css/vendor/bootstrap.min.css
|
209
206
|
- lib/beanstalkd_view/resources/js/app.js
|
@@ -246,7 +243,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
246
243
|
version: '0'
|
247
244
|
segments:
|
248
245
|
- 0
|
249
|
-
hash:
|
246
|
+
hash: 1970467942070673531
|
250
247
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
251
248
|
none: false
|
252
249
|
requirements:
|
@@ -255,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
255
252
|
version: '0'
|
256
253
|
segments:
|
257
254
|
- 0
|
258
|
-
hash:
|
255
|
+
hash: 1970467942070673531
|
259
256
|
requirements: []
|
260
257
|
rubyforge_project:
|
261
258
|
rubygems_version: 1.8.24
|
data/lib/beanstalkd_view/Gemfile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# Overiding the standard beanstalk-client Pool to ignore NotFoundErrors.
|
2
|
-
# In this application, those errors should only occur when using multiple beanstalkd instances,
|
3
|
-
# when one instance does not have a tube, and others do.
|
4
|
-
module Beanstalk
|
5
|
-
class Pool
|
6
|
-
def call_wrap(c, *args, &block)
|
7
|
-
self.last_conn = c
|
8
|
-
c.send(*args, &block)
|
9
|
-
rescue NotFoundError => ex
|
10
|
-
puts "Ignoring NotFoundError: #{ex.class}: #{ex}"
|
11
|
-
nil
|
12
|
-
rescue UnexpectedResponse => ex
|
13
|
-
raise ex
|
14
|
-
rescue EOFError, Errno::ECONNRESET, Errno::EPIPE => ex
|
15
|
-
self.remove(c)
|
16
|
-
raise ex
|
17
|
-
end
|
18
|
-
|
19
|
-
def on_tube(tube, &block)
|
20
|
-
response = nil
|
21
|
-
connection_size = open_connections.size
|
22
|
-
# Retry if the desired tube is not found
|
23
|
-
# Randomly picking over double the connection size, should eventually find it...
|
24
|
-
# but a better algorithm would be nicer at some point...
|
25
|
-
# Note, that with just 1 beanstalkd instance, this code should always return on the first send
|
26
|
-
for i in 1..(connection_size*2)
|
27
|
-
response = send_to_rand_conn(:on_tube, tube, &block)
|
28
|
-
break if not response.nil?
|
29
|
-
end
|
30
|
-
response
|
31
|
-
end
|
32
|
-
|
33
|
-
# Overide the default behavior which uses send_to_all_conn, which returns Hash values for stats combining
|
34
|
-
def peek_job(id)
|
35
|
-
send_to_each_conn_first_res(:peek_job, id)
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|