delayed_job_web 1.3 → 1.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of delayed_job_web might be problematic. Click here for more details.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5edfc338b6fb18fabbd06ed11c0c9333ca1c76b2
|
4
|
+
data.tar.gz: f4400d803f007745ac56d87c36ec174850a27243
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7edfb192fe584d1bdc6468247e0149a7e074f3d08e629614345d7d305d97ff5712af5455e347b1fd83ac2001285e44ee4c05bd941599569394e360cf0f43babc
|
7
|
+
data.tar.gz: 08cda19f9dc812a1564a10c0391b40ad215d53021a3ecaa81d2e4d57a2d530caead7f56a012c13106a7400aa5bc05aebee9f0b1bc737718786c1258024012af6
|
data/README.markdown
CHANGED
@@ -101,6 +101,19 @@ Rails' will need to be configured to `config.action_dispatch.x_sendfile_header =
|
|
101
101
|
|
102
102
|
Lighty is more `X-Sendfile`, like [outlined](http://redmine.lighttpd.net/projects/1/wiki/X-LIGHTTPD-send-file) in their wiki.
|
103
103
|
|
104
|
+
Configuration
|
105
|
+
-------------
|
106
|
+
|
107
|
+
The following settings can be changed using the `.set` method in your configu.ru. For example:
|
108
|
+
|
109
|
+
```ruby
|
110
|
+
DelayedJobWeb.set(:allow_requeue_pending, false)
|
111
|
+
```
|
112
|
+
|
113
|
+
* **`allow_requeue_pending`** (default: `true`)
|
114
|
+
|
115
|
+
Controls whether the 'Enqueue all immediately' button is available on the list of Pending jobs. Hiding this button can be useful if you have jobs set to run in the future and you don't want to accidentally run them immediately.
|
116
|
+
|
104
117
|
|
105
118
|
Contributing
|
106
119
|
------------
|
data/delayed_job_web.gemspec
CHANGED
@@ -9,6 +9,8 @@ class DelayedJobWeb < Sinatra::Base
|
|
9
9
|
set :public_folder, File.expand_path('../public', __FILE__)
|
10
10
|
set :views, File.expand_path('../views', __FILE__)
|
11
11
|
|
12
|
+
set :allow_requeue_pending, true
|
13
|
+
|
12
14
|
# Enable sessions so we can use CSRF protection
|
13
15
|
enable :sessions
|
14
16
|
|
@@ -38,7 +40,7 @@ class DelayedJobWeb < Sinatra::Base
|
|
38
40
|
end
|
39
41
|
|
40
42
|
def per_page
|
41
|
-
20
|
43
|
+
params[:per_page].to_i > 0 ? params[:per_page].to_i : 20
|
42
44
|
end
|
43
45
|
|
44
46
|
def url_path(*path_parts)
|
@@ -120,6 +122,7 @@ class DelayedJobWeb < Sinatra::Base
|
|
120
122
|
get "/#{page}" do
|
121
123
|
@jobs = delayed_jobs(page.to_sym, @queues).order('created_at desc, id desc').offset(start).limit(per_page)
|
122
124
|
@all_jobs = delayed_jobs(page.to_sym, @queues)
|
125
|
+
@allow_requeue_pending = settings.allow_requeue_pending
|
123
126
|
erb page.to_sym
|
124
127
|
end
|
125
128
|
end
|
@@ -129,11 +132,16 @@ class DelayedJobWeb < Sinatra::Base
|
|
129
132
|
redirect back
|
130
133
|
end
|
131
134
|
|
132
|
-
|
133
|
-
|
134
|
-
delayed_jobs(
|
135
|
-
redirect back
|
135
|
+
post "/requeue/pending" do
|
136
|
+
if settings.allow_requeue_pending
|
137
|
+
delayed_jobs(:pending, @queues).update_all(:run_at => Time.now, :failed_at => nil)
|
136
138
|
end
|
139
|
+
redirect back
|
140
|
+
end
|
141
|
+
|
142
|
+
post "/requeue/failed" do
|
143
|
+
delayed_jobs(:failed, @queues).update_all(:run_at => Time.now, :failed_at => nil)
|
144
|
+
redirect back
|
137
145
|
end
|
138
146
|
|
139
147
|
post "/requeue/:id" do
|
@@ -1,9 +1,11 @@
|
|
1
1
|
<h1>Pending</h1>
|
2
2
|
<% if @jobs.any? %>
|
3
|
-
|
4
|
-
<%=
|
5
|
-
|
6
|
-
|
3
|
+
<% if @allow_requeue_pending -%>
|
4
|
+
<form action="<%= u('requeue/pending') %>" method="POST">
|
5
|
+
<%= csrf_token_tag %>
|
6
|
+
<input type="submit" value="Enqueue All Immediately"></input>
|
7
|
+
</form>
|
8
|
+
<% end -%>
|
7
9
|
<% end %>
|
8
10
|
<p class="sub">
|
9
11
|
The list below contains jobs currently being processed.
|
@@ -52,6 +52,27 @@ class TestDelayedJobWeb < MiniTest::Unit::TestCase
|
|
52
52
|
|
53
53
|
end
|
54
54
|
|
55
|
+
def test_requeue_pending_with_requeue_pending_disallowed
|
56
|
+
|
57
|
+
app.set(:allow_requeue_pending, false)
|
58
|
+
|
59
|
+
dataset = Minitest::Mock.new
|
60
|
+
where = lambda { |criteria|
|
61
|
+
dataset
|
62
|
+
}
|
63
|
+
|
64
|
+
Time.stub(:now, time) do
|
65
|
+
Delayed::Job.stub(:where, where) do
|
66
|
+
post "/requeue/pending", request_data, rack_env
|
67
|
+
last_response.status.must_equal 302
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Expect dataset to not have received any method calls.
|
72
|
+
dataset.verify
|
73
|
+
|
74
|
+
end
|
75
|
+
|
55
76
|
def test_requeue_id
|
56
77
|
job = Minitest::Mock.new
|
57
78
|
job.expect(:update_attributes, nil, [:run_at => time, :failed_at => nil])
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: delayed_job_web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erick Schmitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|