belated 0.5.0 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/CHANGELOG.md +15 -1
- data/Gemfile +2 -2
- data/Gemfile.lock +6 -2
- data/README.md +7 -1
- data/bin/belated +0 -1
- data/lib/belated.rb +5 -1
- data/lib/belated/client.rb +14 -1
- data/lib/belated/queue.rb +6 -1
- data/lib/belated/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 918d89e2f82daa2abdd57976ca18edbf994dcd4c92b4480bf139983f2a51e26d
|
4
|
+
data.tar.gz: 1c684c38e41ba507d048463c4e287802fed0b067f9263702ea9fb3bbc4bfb22c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7db6cbabae254f0152bd4a4367de72ad18085c58923dcb0420e20b94dbab0fb713fc00c54031bbe6788363a626d0a2ad315e6690b6cba0849aade14a406cb2f8
|
7
|
+
data.tar.gz: '0578bcaadeac30fa0d4cea61862de5927ca8624364fcb954a5a2f7f57c3cc1871c4fc99cb0730505aeb7e1f81ee0eb24327f5f48ef5aae4bf85fc5d5647baef3'
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,7 +1,21 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.5.4] - 2021-08-14
|
3
4
|
|
4
|
-
|
5
|
+
- Client was using 100% CPU when it had no connection. (on $5 Digital Ocean droplet) Should be fixed now.
|
6
|
+
|
7
|
+
## [0.5.3] - 2021-08-13
|
8
|
+
|
9
|
+
- A bit less looping - better performance.
|
10
|
+
## [0.5.2] - 2021-08-13
|
11
|
+
|
12
|
+
- An error with shutdown handling was fixed.
|
13
|
+
|
14
|
+
## [0.5.1] - 2021-08-12
|
15
|
+
|
16
|
+
- Requiring byebug in bin file. 😮
|
17
|
+
|
18
|
+
## [0.5.0] - 2021-08-011
|
5
19
|
|
6
20
|
- Job retries! The jobs now have ids, so you can follow the job and it's retries from the log.
|
7
21
|
- Quite a lot has changed internally, so if you were not using the Belated::Queue class to enqueue your jobs, you will need to update your code.
|
data/Gemfile
CHANGED
@@ -9,10 +9,10 @@ gem 'rake', '~> 13.0'
|
|
9
9
|
|
10
10
|
gem 'rspec', '~> 3.0'
|
11
11
|
|
12
|
-
gem 'rubocop', '~> 1.7'
|
13
|
-
|
14
12
|
gem 'database_cleaner-active_record'
|
15
13
|
gem 'rails', '>= 6.1.3'
|
16
14
|
gem 'rspec-rails'
|
15
|
+
gem 'rubocop', '~> 1.7'
|
16
|
+
gem 'rubocop-performance', require: false
|
17
17
|
gem 'sqlite3'
|
18
18
|
gem 'stackprof'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
belated (0.5.
|
4
|
+
belated (0.5.4)
|
5
5
|
drb
|
6
6
|
dry-configurable
|
7
7
|
|
@@ -169,6 +169,9 @@ GEM
|
|
169
169
|
unicode-display_width (>= 1.4.0, < 3.0)
|
170
170
|
rubocop-ast (1.7.0)
|
171
171
|
parser (>= 3.0.1.1)
|
172
|
+
rubocop-performance (1.11.4)
|
173
|
+
rubocop (>= 1.7.0, < 2.0)
|
174
|
+
rubocop-ast (>= 0.4.0)
|
172
175
|
ruby-progressbar (1.11.0)
|
173
176
|
sprockets (4.0.2)
|
174
177
|
concurrent-ruby (~> 1.0)
|
@@ -200,8 +203,9 @@ DEPENDENCIES
|
|
200
203
|
rspec (~> 3.0)
|
201
204
|
rspec-rails
|
202
205
|
rubocop (~> 1.7)
|
206
|
+
rubocop-performance
|
203
207
|
sqlite3
|
204
208
|
stackprof
|
205
209
|
|
206
210
|
BUNDLED WITH
|
207
|
-
2.2.
|
211
|
+
2.2.22
|
data/README.md
CHANGED
@@ -136,9 +136,15 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
136
136
|
|
137
137
|
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).
|
138
138
|
|
139
|
+
|
140
|
+
# Possible problems
|
141
|
+
|
142
|
+
If you have the port 8788 already in use, you can check the ports in use in Linux with the following command:
|
143
|
+
|
144
|
+
$ sudo lsof -i -P -n | grep LISTEN
|
139
145
|
## Contributing
|
140
146
|
|
141
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/sampokuokkanen/belated. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/sampokuokkanen/belated/blob/master/CODE_OF_CONDUCT.md).
|
147
|
+
Bug reports, questions and pull requests are welcome on GitHub at https://github.com/sampokuokkanen/belated. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/sampokuokkanen/belated/blob/master/CODE_OF_CONDUCT.md).
|
142
148
|
|
143
149
|
## License
|
144
150
|
|
data/bin/belated
CHANGED
data/lib/belated.rb
CHANGED
@@ -91,13 +91,17 @@ class Belated
|
|
91
91
|
def enqueue_future_jobs
|
92
92
|
log 'starting future jobs thread'
|
93
93
|
loop do
|
94
|
+
sleep 0.1
|
95
|
+
if @@queue.future_jobs.empty?
|
96
|
+
sleep 1
|
97
|
+
next
|
98
|
+
end
|
94
99
|
@@queue.future_jobs.each_with_index do |job, i|
|
95
100
|
if job.at <= Time.now.utc
|
96
101
|
log "Deleting #{@@queue.future_jobs.delete_at(i)} from future jobs"
|
97
102
|
@@queue.push(job)
|
98
103
|
end
|
99
104
|
end
|
100
|
-
sleep 0.01
|
101
105
|
end
|
102
106
|
end
|
103
107
|
|
data/lib/belated/client.rb
CHANGED
@@ -26,6 +26,12 @@ class Belated
|
|
26
26
|
def start_banker_thread
|
27
27
|
self.banker_thread = Thread.new do
|
28
28
|
loop do
|
29
|
+
sleep 0.01
|
30
|
+
unless drb_connected?
|
31
|
+
sleep(10)
|
32
|
+
next
|
33
|
+
end
|
34
|
+
|
29
35
|
job = bank.pop
|
30
36
|
|
31
37
|
perform(job)
|
@@ -50,9 +56,16 @@ class Belated
|
|
50
56
|
rescue DRb::DRbConnError
|
51
57
|
bank.push(job_wrapper)
|
52
58
|
start_banker_thread if banker_thread.nil?
|
53
|
-
banker_thread.wakeup if banker_thread.status == 'sleep'
|
54
59
|
end
|
55
60
|
alias perform_belated perform
|
56
61
|
alias perform_later perform
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def drb_connected?
|
66
|
+
queue.connected?
|
67
|
+
rescue StandardError
|
68
|
+
false
|
69
|
+
end
|
57
70
|
end
|
58
71
|
end
|
data/lib/belated/queue.rb
CHANGED
@@ -16,7 +16,8 @@ class Belated
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def push(job)
|
19
|
-
if job.at.nil? ||
|
19
|
+
if job == :shutdown || job.at.nil? ||
|
20
|
+
job.at <= Time.now.utc
|
20
21
|
@queue.push(job)
|
21
22
|
else
|
22
23
|
@future_jobs << job
|
@@ -71,6 +72,10 @@ class Belated
|
|
71
72
|
pp File.open(FILE_NAME, 'wb') { |f| f.write(YAML.dump(class_array)) }
|
72
73
|
end
|
73
74
|
|
75
|
+
def connected?
|
76
|
+
true
|
77
|
+
end
|
78
|
+
|
74
79
|
private
|
75
80
|
|
76
81
|
def proc_or_shutdown?(job)
|
data/lib/belated/version.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.4
|
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-08-
|
11
|
+
date: 2021-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: drb
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
requirements: []
|
112
|
-
rubygems_version: 3.2.
|
112
|
+
rubygems_version: 3.2.22
|
113
113
|
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: Run background jobs with Belated and dRuby!
|