beanstalkd_view 1.2.7 → 1.2.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ 1.2.8
2
+ -----------
3
+
4
+ - Reconnect to beanstalkd on Beaneater::NotConnected via @ueno1969
5
+
1
6
  1.2.7
2
7
  -----------
3
8
 
data/README.md CHANGED
@@ -78,7 +78,7 @@ Running with Docker
78
78
 
79
79
  You can have a look at beanstalkd_view by running it in a [Docker][1] container:
80
80
 
81
- docker build -t beanstalkd_view git://denniskuczynski/beanstalkd_view.git
81
+ docker build -t beanstalkd_view git://github.com/denniskuczynski/beanstalkd_view.git
82
82
 
83
83
  docker run -t -i -p 5678:5678 -e BEANSTALK_URL=beanstalk://172.17.0.2 beanstalkd_view
84
84
 
@@ -82,5 +82,14 @@ module BeanstalkdView
82
82
  (min+GUESS_PEEK_RANGE)-1
83
83
  end
84
84
 
85
+ def close_connections
86
+ begin
87
+ beanstalk.close
88
+ rescue Beaneater::NotConnected
89
+ # Ignore not being able to connect if trying to close
90
+ ensure
91
+ @@beanstalk = nil
92
+ end
93
+ end
85
94
  end
86
95
  end
@@ -8,10 +8,10 @@ module BeanstalkdView
8
8
  set :root, root
9
9
  set :views, "#{root}/views"
10
10
  if respond_to? :public_folder
11
- set :public_folder, "#{root}/resources"
12
- else
13
- set :public, "#{root}/resources"
14
- end
11
+ set :public_folder, "#{root}/resources"
12
+ else
13
+ set :public, "#{root}/resources"
14
+ end
15
15
  set :static, true
16
16
 
17
17
  get "/" do
@@ -24,7 +24,10 @@ module BeanstalkdView
24
24
  @total_jobs_data = chart_data["total_jobs_data"]
25
25
  @buried_jobs_data = chart_data["buried_jobs_data"] if chart_data["buried_jobs_data"]["items"].size > 0
26
26
  erb :index
27
- rescue Beaneater::NotConnected, Beaneater::NotFoundError => @error
27
+ rescue Beaneater::NotFoundError => @error
28
+ erb :error
29
+ rescue Beaneater::NotConnected => @error
30
+ close_connections
28
31
  erb :error
29
32
  end
30
33
  end
@@ -42,7 +45,10 @@ module BeanstalkdView
42
45
  cookies[:beanstalkd_view_notice] = "Error adding job"
43
46
  redirect url("/")
44
47
  end
45
- rescue Beaneater::NotConnected, Beaneater::NotFoundError => @error
48
+ rescue Beaneater::NotFoundError => @error
49
+ erb :error
50
+ rescue Beaneater::NotConnected => @error
51
+ close_connections
46
52
  erb :error
47
53
  end
48
54
  end
@@ -52,7 +58,10 @@ module BeanstalkdView
52
58
  @tube = beanstalk.tubes[params[:tube]]
53
59
  @stats = @tube.stats
54
60
  erb :tube_stats
55
- rescue Beaneater::NotConnected, Beaneater::NotFoundError => @error
61
+ rescue Beaneater::NotFoundError => @error
62
+ erb :error
63
+ rescue Beaneater::NotConnected => @error
64
+ close_connections
56
65
  erb :error
57
66
  end
58
67
  end
@@ -67,7 +76,10 @@ module BeanstalkdView
67
76
  else
68
77
  { :error => "No job was found, or an error occurred while trying to peek at the next job."}.to_json
69
78
  end
70
- rescue Beaneater::NotConnected, Beaneater::NotFoundError => @error
79
+ rescue Beaneater::NotFoundError => @error
80
+ { :error => @error.to_s }.to_json
81
+ rescue Beaneater::NotConnected => @error
82
+ close_connections
71
83
  { :error => @error.to_s }.to_json
72
84
  end
73
85
  end
@@ -97,18 +109,21 @@ module BeanstalkdView
97
109
  jobs.each do |job|
98
110
  @jobs << job_to_hash(job)
99
111
  end
100
- rescue Beaneater::NotFoundError => e
112
+ rescue Beaneater::NotFoundError
101
113
  # Since we're looping over potentially non-existant jobs, ignore
102
114
  end
103
115
  end
104
116
  erb :peek_range
105
- rescue Beaneater::NotConnected, Beaneater::NotFoundError => @error
117
+ rescue Beaneater::NotFoundError => @error
118
+ erb :error
119
+ rescue Beaneater::NotConnected => @error
120
+ close_connections
106
121
  erb :error
107
122
  end
108
123
  end
109
124
 
110
125
  get "/delete/:tube/:job_id" do
111
- begin
126
+ begin
112
127
  response = nil
113
128
  jobs = beanstalk.jobs.find_all(params[:job_id].to_i)
114
129
  raise Beaneater::NotFoundError.new("Job not found with specified id", 'find') if jobs.size == 0
@@ -122,9 +137,12 @@ module BeanstalkdView
122
137
  cookies[:beanstalkd_view_notice] = "Error deleting Job #{params[:job_id]}"
123
138
  redirect url("/tube/#{escaped_tube_param}")
124
139
  end
125
- rescue Beaneater::NotConnected, Beaneater::NotFoundError => @error
126
- erb :error
127
- end
140
+ rescue Beaneater::NotFoundError => @error
141
+ erb :error
142
+ rescue Beaneater::NotConnected => @error
143
+ close_connections
144
+ erb :error
145
+ end
128
146
  end
129
147
 
130
148
  post "/pause" do
@@ -138,7 +156,10 @@ module BeanstalkdView
138
156
  cookies[:beanstalkd_view_notice] = "Error pausing #{params[:tube]}."
139
157
  redirect url("/tube/#{escaped_tube_param}")
140
158
  end
141
- rescue Beaneater::NotConnected, Beaneater::NotFoundError => @error
159
+ rescue Beaneater::NotFoundError => @error
160
+ erb :error
161
+ rescue Beaneater::NotConnected => @error
162
+ close_connections
142
163
  erb :error
143
164
  end
144
165
  end
@@ -156,7 +177,10 @@ module BeanstalkdView
156
177
  cookies[:beanstalkd_view_notice] = "State isn't included in #{allowed_states.join(', ')}."
157
178
  end
158
179
  redirect url("/tube/#{escaped_tube_param}")
159
- rescue Beaneater::NotConnected, Beaneater::NotFoundError => @error
180
+ rescue Beaneater::NotFoundError => @error
181
+ erb :error
182
+ rescue Beaneater::NotConnected => @error
183
+ close_connections
160
184
  erb :error
161
185
  end
162
186
  end
@@ -173,7 +197,10 @@ module BeanstalkdView
173
197
  cookies[:beanstalkd_view_notice] = "Error kicking #{params[:tube]}."
174
198
  redirect url("/tube/#{escaped_tube_param}")
175
199
  end
176
- rescue Beaneater::NotConnected, Beaneater::NotFoundError => @error
200
+ rescue Beaneater::NotFoundError => @error
201
+ erb :error
202
+ rescue Beaneater::NotConnected => @error
203
+ close_connections
177
204
  erb :error
178
205
  end
179
206
  end
@@ -1,3 +1,3 @@
1
1
  module BeanstalkdView
2
- VERSION = "1.2.7"
2
+ VERSION = "1.2.8"
3
3
  end
@@ -6716,3 +6716,30 @@ Started GET "/beanstalkd/" for 127.0.0.1 at 2013-10-06 20:17:11 -0400
6716
6716
 
6717
6717
 
6718
6718
  Started GET "/beanstalkd/tube/default" for 127.0.0.1 at 2013-10-06 20:17:12 -0400
6719
+
6720
+
6721
+ Started GET "/beanstalkd/" for 127.0.0.1 at 2014-08-11 20:14:55 -0400
6722
+
6723
+
6724
+ Started GET "/beanstalkd/" for 127.0.0.1 at 2014-08-11 20:15:36 -0400
6725
+
6726
+
6727
+ Started GET "/beanstalkd/tube/default" for 127.0.0.1 at 2014-08-11 20:15:37 -0400
6728
+
6729
+
6730
+ Started GET "/beanstalkd/" for 127.0.0.1 at 2014-08-11 20:16:03 -0400
6731
+
6732
+
6733
+ Started GET "/beanstalkd/tube/default" for 127.0.0.1 at 2014-08-11 20:16:03 -0400
6734
+
6735
+
6736
+ Started GET "/beanstalkd/" for 127.0.0.1 at 2014-08-11 20:16:29 -0400
6737
+
6738
+
6739
+ Started GET "/beanstalkd/tube/default" for 127.0.0.1 at 2014-08-11 20:16:29 -0400
6740
+
6741
+
6742
+ Started GET "/beanstalkd/" for 127.0.0.1 at 2014-08-11 20:18:21 -0400
6743
+
6744
+
6745
+ Started GET "/beanstalkd/tube/default" for 127.0.0.1 at 2014-08-11 20:18:21 -0400
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.2.7
4
+ version: 1.2.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,14 +9,14 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-28 00:00:00.000000000 Z
12
+ date: 2014-08-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: 1.3.0
22
22
  type: :runtime
@@ -24,7 +24,7 @@ dependencies:
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: 1.3.0
30
30
  - !ruby/object:Gem::Dependency
@@ -32,7 +32,7 @@ dependencies:
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - ! '>='
35
+ - - '>='
36
36
  - !ruby/object:Gem::Version
37
37
  version: 1.3.0
38
38
  type: :runtime
@@ -40,7 +40,7 @@ dependencies:
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ! '>='
43
+ - - '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: 1.3.0
46
46
  - !ruby/object:Gem::Dependency
@@ -80,7 +80,7 @@ dependencies:
80
80
  requirement: !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
- - - ! '>='
83
+ - - '>='
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
86
  type: :runtime
@@ -88,7 +88,7 @@ dependencies:
88
88
  version_requirements: !ruby/object:Gem::Requirement
89
89
  none: false
90
90
  requirements:
91
- - - ! '>='
91
+ - - '>='
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  - !ruby/object:Gem::Dependency
@@ -96,7 +96,7 @@ dependencies:
96
96
  requirement: !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
- - - ! '>='
99
+ - - '>='
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  type: :development
@@ -104,7 +104,7 @@ dependencies:
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
- - - ! '>='
107
+ - - '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  - !ruby/object:Gem::Dependency
@@ -112,7 +112,7 @@ dependencies:
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
115
- - - ! '>='
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
@@ -120,7 +120,7 @@ dependencies:
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  none: false
122
122
  requirements:
123
- - - ! '>='
123
+ - - '>='
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
126
  - !ruby/object:Gem::Dependency
@@ -128,7 +128,7 @@ dependencies:
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
131
- - - ! '>='
131
+ - - '>='
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  type: :development
@@ -136,7 +136,7 @@ dependencies:
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  none: false
138
138
  requirements:
139
- - - ! '>='
139
+ - - '>='
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  - !ruby/object:Gem::Dependency
@@ -144,7 +144,7 @@ dependencies:
144
144
  requirement: !ruby/object:Gem::Requirement
145
145
  none: false
146
146
  requirements:
147
- - - ! '>='
147
+ - - '>='
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0'
150
150
  type: :development
@@ -152,7 +152,7 @@ dependencies:
152
152
  version_requirements: !ruby/object:Gem::Requirement
153
153
  none: false
154
154
  requirements:
155
- - - ! '>='
155
+ - - '>='
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  - !ruby/object:Gem::Dependency
@@ -160,7 +160,7 @@ dependencies:
160
160
  requirement: !ruby/object:Gem::Requirement
161
161
  none: false
162
162
  requirements:
163
- - - ! '>='
163
+ - - '>='
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0'
166
166
  type: :development
@@ -168,7 +168,7 @@ dependencies:
168
168
  version_requirements: !ruby/object:Gem::Requirement
169
169
  none: false
170
170
  requirements:
171
- - - ! '>='
171
+ - - '>='
172
172
  - !ruby/object:Gem::Version
173
173
  version: '0'
174
174
  description: A Sinatra app to view/manage beanstalkd queues that can be embedded in
@@ -228,24 +228,18 @@ require_paths:
228
228
  required_ruby_version: !ruby/object:Gem::Requirement
229
229
  none: false
230
230
  requirements:
231
- - - ! '>='
231
+ - - '>='
232
232
  - !ruby/object:Gem::Version
233
233
  version: '0'
234
- segments:
235
- - 0
236
- hash: -3022094544355637058
237
234
  required_rubygems_version: !ruby/object:Gem::Requirement
238
235
  none: false
239
236
  requirements:
240
- - - ! '>='
237
+ - - '>='
241
238
  - !ruby/object:Gem::Version
242
239
  version: '0'
243
- segments:
244
- - 0
245
- hash: -3022094544355637058
246
240
  requirements: []
247
241
  rubyforge_project:
248
- rubygems_version: 1.8.25
242
+ rubygems_version: 1.8.28
249
243
  signing_key:
250
244
  specification_version: 3
251
245
  summary: A Sinatra app to view/manage beanstalkd queues that can be embedded in a