belated 0.8.3 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -2
- data/.rspec +2 -1
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +79 -79
- data/README.md +15 -0
- data/app/controllers/belated/admin_controller.rb +18 -0
- data/app/views/belated/admin/future_jobs.html.erb +20 -0
- data/app/views/belated/admin/index.html.erb +3 -0
- data/app/views/layouts/belated/admin.html.erb +13 -0
- data/config/routes.rb +6 -0
- data/lib/belated/{rails.rb → engine.rb} +1 -1
- data/lib/belated/queue.rb +1 -2
- data/lib/belated/version.rb +1 -1
- data/lib/belated/worker.rb +1 -1
- data/lib/belated.rb +27 -16
- metadata +8 -4
- data/lib/belated/job.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67777540e4d30c80208702f5724fa0e1d1cd37fcfb454b5f631f97892f6c1a47
|
4
|
+
data.tar.gz: 811689e8a3a180b03a42885c90441aaaada3786b23f6bc4379c78b5376da0072
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a02df25ac3e60f1bce4d470aceccc6208c4abe938e5b051f0ace46dc86569b316bdc13230d51a4008c36927bdcf4c57dbb843200ea8f2e2575d8570bcfca4251
|
7
|
+
data.tar.gz: 5ac24e84ed38c3728b5f589deb66a16722b5c3e73da3c61e83803c0574c16e8b42da99bd8148b19bd1a316765de9b552967082fa53d3ac63c1c285e3263a1a69
|
data/.gitignore
CHANGED
data/.rspec
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.9.0] - 2021-11-03
|
4
|
+
- Fix env setting bug. If you set env, it was not working... now it should work.
|
5
|
+
- Add rudimentary admin panel. You can see future jobs from there.
|
3
6
|
## [0.8.3] - 2021-09-10
|
4
7
|
- Add environment to the names of the pstore files. This way you won't get your development, staging, and production jobs mixed up. (I was getting my test and dev jobs mixed up)
|
5
8
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
belated (0.
|
4
|
+
belated (0.9.0)
|
5
5
|
drb
|
6
6
|
dry-configurable
|
7
7
|
pstore
|
@@ -11,60 +11,60 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
actioncable (6.1.4)
|
15
|
-
actionpack (= 6.1.4)
|
16
|
-
activesupport (= 6.1.4)
|
14
|
+
actioncable (6.1.4.1)
|
15
|
+
actionpack (= 6.1.4.1)
|
16
|
+
activesupport (= 6.1.4.1)
|
17
17
|
nio4r (~> 2.0)
|
18
18
|
websocket-driver (>= 0.6.1)
|
19
|
-
actionmailbox (6.1.4)
|
20
|
-
actionpack (= 6.1.4)
|
21
|
-
activejob (= 6.1.4)
|
22
|
-
activerecord (= 6.1.4)
|
23
|
-
activestorage (= 6.1.4)
|
24
|
-
activesupport (= 6.1.4)
|
19
|
+
actionmailbox (6.1.4.1)
|
20
|
+
actionpack (= 6.1.4.1)
|
21
|
+
activejob (= 6.1.4.1)
|
22
|
+
activerecord (= 6.1.4.1)
|
23
|
+
activestorage (= 6.1.4.1)
|
24
|
+
activesupport (= 6.1.4.1)
|
25
25
|
mail (>= 2.7.1)
|
26
|
-
actionmailer (6.1.4)
|
27
|
-
actionpack (= 6.1.4)
|
28
|
-
actionview (= 6.1.4)
|
29
|
-
activejob (= 6.1.4)
|
30
|
-
activesupport (= 6.1.4)
|
26
|
+
actionmailer (6.1.4.1)
|
27
|
+
actionpack (= 6.1.4.1)
|
28
|
+
actionview (= 6.1.4.1)
|
29
|
+
activejob (= 6.1.4.1)
|
30
|
+
activesupport (= 6.1.4.1)
|
31
31
|
mail (~> 2.5, >= 2.5.4)
|
32
32
|
rails-dom-testing (~> 2.0)
|
33
|
-
actionpack (6.1.4)
|
34
|
-
actionview (= 6.1.4)
|
35
|
-
activesupport (= 6.1.4)
|
33
|
+
actionpack (6.1.4.1)
|
34
|
+
actionview (= 6.1.4.1)
|
35
|
+
activesupport (= 6.1.4.1)
|
36
36
|
rack (~> 2.0, >= 2.0.9)
|
37
37
|
rack-test (>= 0.6.3)
|
38
38
|
rails-dom-testing (~> 2.0)
|
39
39
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
40
|
-
actiontext (6.1.4)
|
41
|
-
actionpack (= 6.1.4)
|
42
|
-
activerecord (= 6.1.4)
|
43
|
-
activestorage (= 6.1.4)
|
44
|
-
activesupport (= 6.1.4)
|
40
|
+
actiontext (6.1.4.1)
|
41
|
+
actionpack (= 6.1.4.1)
|
42
|
+
activerecord (= 6.1.4.1)
|
43
|
+
activestorage (= 6.1.4.1)
|
44
|
+
activesupport (= 6.1.4.1)
|
45
45
|
nokogiri (>= 1.8.5)
|
46
|
-
actionview (6.1.4)
|
47
|
-
activesupport (= 6.1.4)
|
46
|
+
actionview (6.1.4.1)
|
47
|
+
activesupport (= 6.1.4.1)
|
48
48
|
builder (~> 3.1)
|
49
49
|
erubi (~> 1.4)
|
50
50
|
rails-dom-testing (~> 2.0)
|
51
51
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
52
|
-
activejob (6.1.4)
|
53
|
-
activesupport (= 6.1.4)
|
52
|
+
activejob (6.1.4.1)
|
53
|
+
activesupport (= 6.1.4.1)
|
54
54
|
globalid (>= 0.3.6)
|
55
|
-
activemodel (6.1.4)
|
56
|
-
activesupport (= 6.1.4)
|
57
|
-
activerecord (6.1.4)
|
58
|
-
activemodel (= 6.1.4)
|
59
|
-
activesupport (= 6.1.4)
|
60
|
-
activestorage (6.1.4)
|
61
|
-
actionpack (= 6.1.4)
|
62
|
-
activejob (= 6.1.4)
|
63
|
-
activerecord (= 6.1.4)
|
64
|
-
activesupport (= 6.1.4)
|
55
|
+
activemodel (6.1.4.1)
|
56
|
+
activesupport (= 6.1.4.1)
|
57
|
+
activerecord (6.1.4.1)
|
58
|
+
activemodel (= 6.1.4.1)
|
59
|
+
activesupport (= 6.1.4.1)
|
60
|
+
activestorage (6.1.4.1)
|
61
|
+
actionpack (= 6.1.4.1)
|
62
|
+
activejob (= 6.1.4.1)
|
63
|
+
activerecord (= 6.1.4.1)
|
64
|
+
activesupport (= 6.1.4.1)
|
65
65
|
marcel (~> 1.0.0)
|
66
66
|
mini_mime (>= 1.1.0)
|
67
|
-
activesupport (6.1.4)
|
67
|
+
activesupport (6.1.4.1)
|
68
68
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
69
69
|
i18n (>= 1.6, < 2)
|
70
70
|
minitest (>= 5.1)
|
@@ -80,66 +80,67 @@ GEM
|
|
80
80
|
database_cleaner-core (~> 2.0.0)
|
81
81
|
database_cleaner-core (2.0.1)
|
82
82
|
diff-lcs (1.4.4)
|
83
|
-
drb (2.0
|
84
|
-
|
83
|
+
drb (2.1.0)
|
84
|
+
ruby2_keywords
|
85
|
+
dry-configurable (0.13.0)
|
85
86
|
concurrent-ruby (~> 1.0)
|
86
|
-
dry-core (~> 0.
|
87
|
+
dry-core (~> 0.6)
|
87
88
|
dry-core (0.7.1)
|
88
89
|
concurrent-ruby (~> 1.0)
|
89
90
|
erubi (1.10.0)
|
90
|
-
globalid (0.
|
91
|
-
activesupport (>=
|
91
|
+
globalid (0.5.2)
|
92
|
+
activesupport (>= 5.0)
|
92
93
|
i18n (1.8.10)
|
93
94
|
concurrent-ruby (~> 1.0)
|
94
|
-
loofah (2.
|
95
|
+
loofah (2.12.0)
|
95
96
|
crass (~> 1.0.2)
|
96
97
|
nokogiri (>= 1.5.9)
|
97
98
|
mail (2.7.1)
|
98
99
|
mini_mime (>= 0.1.1)
|
99
|
-
marcel (1.0.
|
100
|
+
marcel (1.0.2)
|
100
101
|
method_source (1.0.0)
|
101
|
-
mini_mime (1.1.
|
102
|
+
mini_mime (1.1.2)
|
102
103
|
mini_portile2 (2.6.1)
|
103
104
|
minitest (5.14.4)
|
104
|
-
nio4r (2.5.
|
105
|
-
nokogiri (1.12.
|
105
|
+
nio4r (2.5.8)
|
106
|
+
nokogiri (1.12.5)
|
106
107
|
mini_portile2 (~> 2.6.1)
|
107
108
|
racc (~> 1.4)
|
108
|
-
nokogiri (1.12.
|
109
|
+
nokogiri (1.12.5-x86_64-darwin)
|
109
110
|
racc (~> 1.4)
|
110
|
-
nokogiri (1.12.
|
111
|
+
nokogiri (1.12.5-x86_64-linux)
|
111
112
|
racc (~> 1.4)
|
112
|
-
parallel (1.
|
113
|
+
parallel (1.21.0)
|
113
114
|
parser (3.0.2.0)
|
114
115
|
ast (~> 2.4.1)
|
115
116
|
pstore (0.1.1)
|
116
|
-
racc (1.
|
117
|
+
racc (1.6.0)
|
117
118
|
rack (2.2.3)
|
118
119
|
rack-test (1.1.0)
|
119
120
|
rack (>= 1.0, < 3)
|
120
|
-
rails (6.1.4)
|
121
|
-
actioncable (= 6.1.4)
|
122
|
-
actionmailbox (= 6.1.4)
|
123
|
-
actionmailer (= 6.1.4)
|
124
|
-
actionpack (= 6.1.4)
|
125
|
-
actiontext (= 6.1.4)
|
126
|
-
actionview (= 6.1.4)
|
127
|
-
activejob (= 6.1.4)
|
128
|
-
activemodel (= 6.1.4)
|
129
|
-
activerecord (= 6.1.4)
|
130
|
-
activestorage (= 6.1.4)
|
131
|
-
activesupport (= 6.1.4)
|
121
|
+
rails (6.1.4.1)
|
122
|
+
actioncable (= 6.1.4.1)
|
123
|
+
actionmailbox (= 6.1.4.1)
|
124
|
+
actionmailer (= 6.1.4.1)
|
125
|
+
actionpack (= 6.1.4.1)
|
126
|
+
actiontext (= 6.1.4.1)
|
127
|
+
actionview (= 6.1.4.1)
|
128
|
+
activejob (= 6.1.4.1)
|
129
|
+
activemodel (= 6.1.4.1)
|
130
|
+
activerecord (= 6.1.4.1)
|
131
|
+
activestorage (= 6.1.4.1)
|
132
|
+
activesupport (= 6.1.4.1)
|
132
133
|
bundler (>= 1.15.0)
|
133
|
-
railties (= 6.1.4)
|
134
|
+
railties (= 6.1.4.1)
|
134
135
|
sprockets-rails (>= 2.0.0)
|
135
136
|
rails-dom-testing (2.0.3)
|
136
137
|
activesupport (>= 4.2.0)
|
137
138
|
nokogiri (>= 1.6)
|
138
|
-
rails-html-sanitizer (1.
|
139
|
+
rails-html-sanitizer (1.4.2)
|
139
140
|
loofah (~> 2.3)
|
140
|
-
railties (6.1.4)
|
141
|
-
actionpack (= 6.1.4)
|
142
|
-
activesupport (= 6.1.4)
|
141
|
+
railties (6.1.4.1)
|
142
|
+
actionpack (= 6.1.4.1)
|
143
|
+
activesupport (= 6.1.4.1)
|
143
144
|
method_source
|
144
145
|
rake (>= 0.13)
|
145
146
|
thor (~> 1.0)
|
@@ -160,7 +161,7 @@ GEM
|
|
160
161
|
rspec-mocks (3.10.2)
|
161
162
|
diff-lcs (>= 1.2.0, < 2.0)
|
162
163
|
rspec-support (~> 3.10.0)
|
163
|
-
rspec-rails (5.0.
|
164
|
+
rspec-rails (5.0.2)
|
164
165
|
actionpack (>= 5.2)
|
165
166
|
activesupport (>= 5.2)
|
166
167
|
railties (>= 5.2)
|
@@ -169,26 +170,25 @@ GEM
|
|
169
170
|
rspec-mocks (~> 3.10)
|
170
171
|
rspec-support (~> 3.10)
|
171
172
|
rspec-support (3.10.2)
|
172
|
-
rubocop (1.
|
173
|
+
rubocop (1.22.3)
|
173
174
|
parallel (~> 1.10)
|
174
175
|
parser (>= 3.0.0.0)
|
175
176
|
rainbow (>= 2.2.2, < 4.0)
|
176
177
|
regexp_parser (>= 1.8, < 3.0)
|
177
178
|
rexml
|
178
|
-
rubocop-ast (>= 1.
|
179
|
+
rubocop-ast (>= 1.12.0, < 2.0)
|
179
180
|
ruby-progressbar (~> 1.7)
|
180
181
|
unicode-display_width (>= 1.4.0, < 3.0)
|
181
|
-
rubocop-ast (1.
|
182
|
+
rubocop-ast (1.12.0)
|
182
183
|
parser (>= 3.0.1.1)
|
183
184
|
rubocop-discourse (2.4.2)
|
184
185
|
rubocop (>= 1.1.0)
|
185
186
|
rubocop-rspec (>= 2.0.0)
|
186
|
-
rubocop-rspec (2.
|
187
|
-
rubocop (~> 1.
|
188
|
-
rubocop-ast (>= 1.1.0)
|
187
|
+
rubocop-rspec (2.5.0)
|
188
|
+
rubocop (~> 1.19)
|
189
189
|
ruby-progressbar (1.11.0)
|
190
190
|
ruby2_keywords (0.0.5)
|
191
|
-
set (1.0.
|
191
|
+
set (1.0.2)
|
192
192
|
sorted_set (1.0.3)
|
193
193
|
rbtree
|
194
194
|
set (~> 1.0)
|
@@ -203,11 +203,11 @@ GEM
|
|
203
203
|
thor (1.1.0)
|
204
204
|
tzinfo (2.0.4)
|
205
205
|
concurrent-ruby (~> 1.0)
|
206
|
-
unicode-display_width (2.
|
206
|
+
unicode-display_width (2.1.0)
|
207
207
|
websocket-driver (0.7.5)
|
208
208
|
websocket-extensions (>= 0.1.0)
|
209
209
|
websocket-extensions (0.1.5)
|
210
|
-
zeitwerk (2.
|
210
|
+
zeitwerk (2.5.1)
|
211
211
|
|
212
212
|
PLATFORMS
|
213
213
|
ruby
|
data/README.md
CHANGED
@@ -123,16 +123,30 @@ client.perform_belated(job, Time.now + 1.month)
|
|
123
123
|
|
124
124
|
The client also holds references to the jobs that are instances of `Proc` that have been pushed so that they are not collected by GC. This is because procs are passed by reference, and the client needs to keep them alive. They are removed from the list when the job is done.
|
125
125
|
|
126
|
+
There is also a rudimentary admin panel:
|
127
|
+
1. Mount the engine routes
|
128
|
+
```ruby
|
129
|
+
# routes.rb
|
130
|
+
mount Belated::Engine => '/belated'
|
131
|
+
```
|
132
|
+
|
133
|
+
Then access it at `/belated/` for job search based on id or see future jobs at `/belated/future_jobs`.
|
134
|
+
Warning: Very rudimentary.
|
135
|
+
|
126
136
|
# Settings
|
127
137
|
|
128
138
|
Configuring Belated:
|
129
139
|
|
130
140
|
```ruby
|
131
141
|
Belated.configure do |config|
|
142
|
+
config.env = 'production' # Defaults to production
|
132
143
|
config.rails = false # default is true
|
133
144
|
config.rails_path = # './dummy' default is '.'
|
134
145
|
config.connect = false # Connect to dRuby, default is true, useful for testing only
|
135
146
|
config.workers = 2 # default is 1
|
147
|
+
config.basic_auth.user = 'user' # default is Belated
|
148
|
+
config.basic_auth.password = 'password' # default is Belated123
|
149
|
+
# Set nil for both if you don't want basic auth
|
136
150
|
end
|
137
151
|
```
|
138
152
|
|
@@ -178,6 +192,7 @@ Belated::Client.test_mode_off! # Turn off inline job processing
|
|
178
192
|
## Development
|
179
193
|
|
180
194
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
195
|
+
On Ubuntu, if you have an SQLite install error, try `sudo apt-get install libsqlite3-dev`.
|
181
196
|
|
182
197
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
183
198
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class Belated
|
2
|
+
# Controller in charge of admin side of Belated.
|
3
|
+
class AdminController < ::ActionController::Base
|
4
|
+
if (name = Belated.basic_auth.name) && (pass = Belated.basic_auth.password)
|
5
|
+
http_basic_authenticate_with name: name, password: pass
|
6
|
+
end
|
7
|
+
|
8
|
+
def index
|
9
|
+
return unless request.post?
|
10
|
+
|
11
|
+
@belated = Belated.find params[:job_id]
|
12
|
+
end
|
13
|
+
|
14
|
+
def future_jobs
|
15
|
+
@belateds = Belated.all_future_jobs
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<table class="table jobs">
|
2
|
+
<thead>
|
3
|
+
<th>
|
4
|
+
Job Name
|
5
|
+
</th>
|
6
|
+
<th>
|
7
|
+
Job Time
|
8
|
+
</th>
|
9
|
+
</thead>
|
10
|
+
<%= @belateds.each do |job| %>
|
11
|
+
<tr>
|
12
|
+
<td>
|
13
|
+
<%= job.job.inspect %>
|
14
|
+
</td>
|
15
|
+
<td>
|
16
|
+
<%= job.at %>
|
17
|
+
</td>
|
18
|
+
</tr>
|
19
|
+
<% end %>
|
20
|
+
</table>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Belated</title>
|
5
|
+
|
6
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
7
|
+
</head>
|
8
|
+
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
</body>
|
13
|
+
</html>
|
data/config/routes.rb
ADDED
data/lib/belated/queue.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'belated/job'
|
4
3
|
require 'belated/logging'
|
5
4
|
require 'belated/job_wrapper'
|
6
5
|
require 'sorted_set'
|
@@ -21,7 +20,7 @@ class Belated
|
|
21
20
|
@queue = queue
|
22
21
|
@mutex = Mutex.new
|
23
22
|
self.future_jobs = future_jobs
|
24
|
-
self.future_jobs_db = PStore.new("future_jobs_#{Belated.
|
23
|
+
self.future_jobs_db = PStore.new("future_jobs_#{Belated.env}.pstore", true) # pass true for thread safety
|
25
24
|
end
|
26
25
|
|
27
26
|
def enqueue_future_jobs
|
data/lib/belated/version.rb
CHANGED
data/lib/belated/worker.rb
CHANGED
@@ -42,7 +42,7 @@ class Belated
|
|
42
42
|
today = Time.now.strftime('%F')
|
43
43
|
return @store if @store&.path&.include?(today)
|
44
44
|
|
45
|
-
@store = PStore.new("history_#{Belated.
|
45
|
+
@store = PStore.new("history_#{Belated.env}-#{today}.pstore", true)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
end
|
data/lib/belated.rb
CHANGED
@@ -6,6 +6,7 @@ require_relative 'belated/worker'
|
|
6
6
|
require 'belated/client'
|
7
7
|
require 'belated/job_wrapper'
|
8
8
|
require 'belated/queue'
|
9
|
+
require 'ruby2_keywords'
|
9
10
|
require 'drb'
|
10
11
|
require 'dry-configurable'
|
11
12
|
require 'logger'
|
@@ -23,17 +24,22 @@ class Belated
|
|
23
24
|
include Logging
|
24
25
|
include Singleton unless $TESTING
|
25
26
|
|
26
|
-
setting :rails, true
|
27
|
-
setting :rails_path, '.'
|
28
|
-
setting :workers, 1
|
29
|
-
setting :connect, true
|
30
|
-
setting :
|
31
|
-
setting :logger, Logger.new($stdout), reader: true
|
32
|
-
setting :log_level, :info, reader: true
|
33
|
-
setting :host, 'localhost', reader: true
|
34
|
-
setting :port, '8788', reader: true
|
35
|
-
setting :heartbeat, 1, reader: true
|
36
|
-
setting :client_heartbeat, 5, reader: true
|
27
|
+
setting :rails, default: true
|
28
|
+
setting :rails_path, default: '.'
|
29
|
+
setting :workers, default: 1
|
30
|
+
setting :connect, default: true
|
31
|
+
setting :env, default: 'production', reader: true
|
32
|
+
setting :logger, default: Logger.new($stdout), reader: true
|
33
|
+
setting :log_level, default: :info, reader: true
|
34
|
+
setting :host, default: 'localhost', reader: true
|
35
|
+
setting :port, default: '8788', reader: true
|
36
|
+
setting :heartbeat, default: 1, reader: true
|
37
|
+
setting :client_heartbeat, default: 5, reader: true
|
38
|
+
setting :basic_auth, reader: true do
|
39
|
+
setting :name, default: 'Belated'
|
40
|
+
setting :password, default: 'Belated123'
|
41
|
+
end
|
42
|
+
|
37
43
|
URI = "druby://#{Belated.host}:#{Belated.port}"
|
38
44
|
@@queue = Belated::Queue.new
|
39
45
|
|
@@ -65,7 +71,6 @@ class Belated
|
|
65
71
|
end
|
66
72
|
|
67
73
|
def trap_signals
|
68
|
-
pp 'trap'
|
69
74
|
%w[INT TERM].each do |signal|
|
70
75
|
Signal.trap(signal) do
|
71
76
|
@worker_list.length.times do
|
@@ -85,10 +90,9 @@ class Belated
|
|
85
90
|
def boot_app
|
86
91
|
return unless rails?
|
87
92
|
|
88
|
-
ENV['RAILS_ENV'] ||= Belated.
|
93
|
+
ENV['RAILS_ENV'] ||= Belated.env
|
89
94
|
require File.expand_path("#{Belated.config.rails_path}/config/environment.rb")
|
90
95
|
require 'rails/all'
|
91
|
-
require 'belated/rails'
|
92
96
|
require 'active_job/queue_adapters/belated_adapter'
|
93
97
|
end
|
94
98
|
|
@@ -130,7 +134,7 @@ class Belated
|
|
130
134
|
|
131
135
|
def banner_and_info
|
132
136
|
log banner
|
133
|
-
log "Currently running Belated version #{Belated::VERSION} in #{Belated.
|
137
|
+
log "Currently running Belated version #{Belated::VERSION} in #{Belated.env}"
|
134
138
|
log %(Belated running #{@worker_list&.length.to_i} workers on #{URI}...)
|
135
139
|
end
|
136
140
|
|
@@ -158,6 +162,10 @@ class Belated
|
|
158
162
|
clear_queue!
|
159
163
|
end
|
160
164
|
|
165
|
+
def all_future_jobs
|
166
|
+
@@queue.future_jobs
|
167
|
+
end
|
168
|
+
|
161
169
|
def clear_queue!
|
162
170
|
@@queue.clear
|
163
171
|
end
|
@@ -175,4 +183,7 @@ class Belated
|
|
175
183
|
@@queue
|
176
184
|
end
|
177
185
|
end
|
178
|
-
|
186
|
+
if defined?(::Rails)
|
187
|
+
require 'active_job/queue_adapters/belated_adapter'
|
188
|
+
require 'belated/engine'
|
189
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: belated
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sampo Kuokkanen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: drb
|
@@ -115,20 +115,24 @@ files:
|
|
115
115
|
- LICENSE.txt
|
116
116
|
- README.md
|
117
117
|
- Rakefile
|
118
|
+
- app/controllers/belated/admin_controller.rb
|
119
|
+
- app/views/belated/admin/future_jobs.html.erb
|
120
|
+
- app/views/belated/admin/index.html.erb
|
121
|
+
- app/views/layouts/belated/admin.html.erb
|
118
122
|
- belated.gemspec
|
119
123
|
- bin/belated
|
120
124
|
- bin/bundle
|
121
125
|
- bin/console
|
122
126
|
- bin/setup
|
127
|
+
- config/routes.rb
|
123
128
|
- lib/active_job/queue_adapters/belated_adapter.rb
|
124
129
|
- lib/belated.rb
|
125
130
|
- lib/belated/client.rb
|
131
|
+
- lib/belated/engine.rb
|
126
132
|
- lib/belated/exceptions.rb
|
127
|
-
- lib/belated/job.rb
|
128
133
|
- lib/belated/job_wrapper.rb
|
129
134
|
- lib/belated/logging.rb
|
130
135
|
- lib/belated/queue.rb
|
131
|
-
- lib/belated/rails.rb
|
132
136
|
- lib/belated/testing.rb
|
133
137
|
- lib/belated/version.rb
|
134
138
|
- lib/belated/worker.rb
|
data/lib/belated/job.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Job = Struct.new(:klass, :at)
|