pallets 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/examples/config_savvy.rb +1 -1
- data/lib/pallets/cli.rb +4 -0
- data/lib/pallets/configuration.rb +7 -0
- data/lib/pallets/scheduler.rb +10 -4
- data/lib/pallets/version.rb +1 -1
- data/lib/pallets/worker.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 715e8a2c758fa925afce7091b931d4ea71b02f548290d4daf73604cdd463de3d
|
4
|
+
data.tar.gz: 750fd79e4d8aea7920ac4a019ac410d2ec07b910a1cf70e673a628d1604a90de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3c7d08ad9b0de820f14ec4e3a3bbce77d5e10e9d6bfd99b58273360ce8dc6eeedec8d139d0f9445082848f5b9587dc67b706e49794746cc3208d6cde3aa9516
|
7
|
+
data.tar.gz: '0584d9d3faaebea5c615ee6d9c6dc0397d4e65c04cd80b1722a4cea2794bcf5c61a4762a539a2abf2d21e6a9f52de9a7b8f8e5241615168461bdb674a1465772'
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [0.10.0] - 2020-08-30
|
10
|
+
### Added
|
11
|
+
- configure polling interval for scheduler (#60)
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
- handle persisting unforseen worker errors more gracefully (#59)
|
15
|
+
- add initial wait to scheduler startup (#60)
|
16
|
+
|
9
17
|
## [0.9.0] - 2020-07-05
|
10
18
|
### Added
|
11
19
|
- limit number of jobs in given up set by number (#56)
|
data/examples/config_savvy.rb
CHANGED
data/lib/pallets/cli.rb
CHANGED
@@ -63,6 +63,10 @@ module Pallets
|
|
63
63
|
Pallets.configuration.max_failures = max_failures
|
64
64
|
end
|
65
65
|
|
66
|
+
opts.on('-i', '--scheduler-polling-interval NUM', Integer, 'Seconds between scheduler backend polls') do |scheduler_polling_interval|
|
67
|
+
Pallets.configuration.scheduler_polling_interval = scheduler_polling_interval
|
68
|
+
end
|
69
|
+
|
66
70
|
opts.on('-l', '--failed-job-lifespan NUM', Integer, 'Seconds a job stays in the given up set') do |failed_job_lifespan|
|
67
71
|
Pallets.configuration.failed_job_lifespan = failed_job_lifespan
|
68
72
|
end
|
@@ -31,6 +31,12 @@ module Pallets
|
|
31
31
|
# Number of connections to the backend
|
32
32
|
attr_writer :pool_size
|
33
33
|
|
34
|
+
# Number of seconds at which the scheduler checks whether there are jobs
|
35
|
+
# due to be (re)processed. Note that this interval is per process; it might
|
36
|
+
# require tweaking in case of running multiple Pallets instances, so that
|
37
|
+
# the backend is not polled too often
|
38
|
+
attr_accessor :scheduler_polling_interval
|
39
|
+
|
34
40
|
# Serializer used for jobs
|
35
41
|
attr_accessor :serializer
|
36
42
|
|
@@ -52,6 +58,7 @@ module Pallets
|
|
52
58
|
@failed_job_max_count = 1_000
|
53
59
|
@job_timeout = 1_800 # 30 minutes
|
54
60
|
@max_failures = 3
|
61
|
+
@scheduler_polling_interval = 10
|
55
62
|
@serializer = :json
|
56
63
|
@middleware = default_middleware
|
57
64
|
end
|
data/lib/pallets/scheduler.rb
CHANGED
@@ -7,7 +7,7 @@ module Pallets
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def start
|
10
|
-
@thread ||= Thread.new { work }
|
10
|
+
@thread ||= Thread.new { wait_initial_bit; work }
|
11
11
|
end
|
12
12
|
|
13
13
|
def shutdown
|
@@ -40,11 +40,17 @@ module Pallets
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
44
|
-
#
|
43
|
+
def wait_initial_bit
|
44
|
+
# Randomly wait a bit before starting working, so that multiple processes
|
45
|
+
# will not hit the backend all at once
|
46
|
+
wait_a_bit(rand(Pallets.configuration.scheduler_polling_interval))
|
47
|
+
end
|
48
|
+
|
49
|
+
def wait_a_bit(seconds = Pallets.configuration.scheduler_polling_interval)
|
50
|
+
# Wait for roughly the configured number of seconds
|
45
51
|
# We don't want to block the entire polling interval, since we want to
|
46
52
|
# deal with shutdowns synchronously and as fast as possible
|
47
|
-
|
53
|
+
seconds.times do
|
48
54
|
break if needs_to_stop?
|
49
55
|
sleep 1
|
50
56
|
end
|
data/lib/pallets/version.rb
CHANGED
data/lib/pallets/worker.rb
CHANGED
@@ -55,6 +55,8 @@ module Pallets
|
|
55
55
|
rescue => ex
|
56
56
|
Pallets.logger.error "#{ex.class.name}: #{ex.message}"
|
57
57
|
Pallets.logger.error ex.backtrace.join("\n") unless ex.backtrace.nil?
|
58
|
+
# Do not flood the process in case of persisting unforeseen errors
|
59
|
+
sleep 1
|
58
60
|
@manager.replace_worker(self)
|
59
61
|
end
|
60
62
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pallets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Horak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|