skiplock 1.1.5 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -4
- data/bin/skiplock +4 -2
- data/lib/skiplock/manager.rb +11 -7
- data/lib/skiplock/version.rb +1 -2
- data/lib/skiplock.rb +1 -1
- 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: 9dc423c28696ac2e1a85e87cbc5bb97d601fbbaa14a10e58f11945863d3bd04f
|
4
|
+
data.tar.gz: 459d76ff36b464020fb43986713e744500f3f0a2fb0910ee6cec6bd082147630
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9442d819c8eff5cb5df09a58b698dc6ce72d579971519c8947a9e7341b67617d5d1977783474b0602a12ea63a8271be9ddd0320a16062d36b9adfa077f30905
|
7
|
+
data.tar.gz: 2d5fa15b5f165c8ded5aa5fa46a2a0710b53f8379c7d4c56685d37353158f365480fce6203323f20693384deaf092d69bc03efad05f35c500ec2c4a53b7a4b09
|
data/README.md
CHANGED
@@ -54,8 +54,10 @@ The library is quite small compared to other PostgreSQL job queues (eg. *delay_j
|
|
54
54
|
min_threads: 1
|
55
55
|
max_threads: 10
|
56
56
|
max_retries: 20
|
57
|
-
|
58
|
-
|
57
|
+
log_file: skiplock.log
|
58
|
+
log_level: info
|
59
|
+
log_count: 5
|
60
|
+
log_size: 10485760
|
59
61
|
namespace:
|
60
62
|
notification: custom
|
61
63
|
extensions: false
|
@@ -70,8 +72,10 @@ The library is quite small compared to other PostgreSQL job queues (eg. *delay_j
|
|
70
72
|
- **min_threads** (*integer*): sets minimum number of threads staying idle
|
71
73
|
- **max_threads** (*integer*): sets the maximum number of threads allowed to run jobs
|
72
74
|
- **max_retries** (*integer*): sets the maximum attempt a job will be retrying before it is marked expired. See `Retry system` for more details
|
73
|
-
- **
|
74
|
-
- **
|
75
|
+
- **log_file** (*string*): filename for skiplock logs; empty logfile will disable logging
|
76
|
+
- **log_level** (*string*): sets logging level (`debug, info, warn, error, fatal, unknown`)
|
77
|
+
- **log_count** (*integer*): number of log files to keep (ie: log rotation)
|
78
|
+
- **log_size** (*integer*): maximum size per log file (in bytes)
|
75
79
|
- **namespace** (*string*): sets namespace for jobs (workers will only process jobs of specified namespace)
|
76
80
|
- **notification** (*string*): sets the library to be used for notifying errors and exceptions (`auto, airbrake, bugsnag, exception_notification, custom`); using `auto` will detect library if available. See `Notification system` for more details
|
77
81
|
- **extensions** (*multi*): enable or disable the class method extension. See `ClassMethod extension` for more details
|
data/bin/skiplock
CHANGED
@@ -6,8 +6,10 @@ begin
|
|
6
6
|
op = OptionParser.new do |opts|
|
7
7
|
opts.banner = "Usage: #{File.basename($0)} [options]"
|
8
8
|
opts.on('-e', '--environment STRING', String, 'Rails environment')
|
9
|
-
opts.on('-l', '--
|
10
|
-
opts.on('-L', '--
|
9
|
+
opts.on('-l', '--log-file STRING', String, 'Log filename')
|
10
|
+
opts.on('-L', '--log-level STRING', String, 'Log level (debug, info, warn, error, fatal, unknown)')
|
11
|
+
opts.on('-m', '--log-count NUM', Integer, 'Log maximum count (default = 5)')
|
12
|
+
opts.on('-M', '--log-size NUM', Integer, 'Log maximum size (in bytes, default = 10485760)')
|
11
13
|
opts.on('-n', '--namespace STRING', String, 'Job namespace')
|
12
14
|
opts.on('-s', '--graceful-shutdown NUM', Integer, 'Number of seconds to wait for graceful shutdown')
|
13
15
|
opts.on('-r', '--max-retries NUM', Integer, 'Number of maxixum retries')
|
data/lib/skiplock/manager.rb
CHANGED
@@ -85,8 +85,12 @@ module Skiplock
|
|
85
85
|
@logger.info " Max threads: #{@config[:max_threads]}"
|
86
86
|
@logger.info " Environment: #{Rails.env}"
|
87
87
|
@logger.info " Namespace: #{@config[:namespace] || '(nil)'}"
|
88
|
-
@logger.info "
|
89
|
-
|
88
|
+
@logger.info " Log level: #{@config[:log_level]}"
|
89
|
+
if @config[:log_file]
|
90
|
+
@logger.info " Log count: #{@config[:log_count]}"
|
91
|
+
@logger.info " Log size: #{@config[:log_size]}"
|
92
|
+
end
|
93
|
+
@logger.info " Log file: #{@config[:log_file] || '(disabled)'}"
|
90
94
|
@logger.info " Workers: #{@config[:workers]}"
|
91
95
|
@logger.info " Queues: #{@config[:queues].map {|k,v| k + '(' + v.to_s + ')'}.join(', ')}" if @config[:queues].is_a?(Hash)
|
92
96
|
@logger.info " PID: #{Process.pid}"
|
@@ -140,19 +144,19 @@ module Skiplock
|
|
140
144
|
end
|
141
145
|
|
142
146
|
def setup_logger
|
143
|
-
@config[:
|
147
|
+
@config[:log_level] = 'info' unless ['debug','info','warn','error','fatal','unknown'].include?(@config[:log_level].to_s)
|
144
148
|
if defined?(ActiveSupport::BroadcastLogger)
|
145
149
|
@logger = ActiveSupport::BroadcastLogger.new(::Logger.new(STDOUT))
|
146
150
|
else
|
147
151
|
@logger = ActiveSupport::Logger.new(STDOUT)
|
148
152
|
end
|
149
|
-
@logger.level = @config[:
|
153
|
+
@logger.level = @config[:log_level].to_sym
|
150
154
|
Skiplock.logger = @logger
|
151
|
-
if @config[:
|
155
|
+
if @config[:log_file].to_s.length > 0
|
152
156
|
if defined?(ActiveSupport::BroadcastLogger)
|
153
|
-
@logger.broadcast_to(::Logger.new(File.join(Rails.root, 'log', @config[:
|
157
|
+
@logger.broadcast_to(::Logger.new(File.join(Rails.root, 'log', @config[:log_file].to_s), @config[:log_count] || 5, @config[:log_size] || 10485760))
|
154
158
|
else
|
155
|
-
@logger.extend(ActiveSupport::Logger.broadcast(::Logger.new(File.join(Rails.root, 'log', @config[:
|
159
|
+
@logger.extend(ActiveSupport::Logger.broadcast(::Logger.new(File.join(Rails.root, 'log', @config[:log_file].to_s), @config[:log_count] || 5, @config[:log_size] || 10485760)))
|
156
160
|
end
|
157
161
|
ActiveJob::Base.logger = nil
|
158
162
|
end
|
data/lib/skiplock/version.rb
CHANGED
data/lib/skiplock.rb
CHANGED
@@ -11,7 +11,7 @@ require 'skiplock/worker'
|
|
11
11
|
require 'skiplock/version'
|
12
12
|
|
13
13
|
module Skiplock
|
14
|
-
DEFAULT_CONFIG = { 'graceful_shutdown' => 15, 'min_threads' => 1, 'max_threads' => 10, 'max_retries' => 20, '
|
14
|
+
DEFAULT_CONFIG = { 'graceful_shutdown' => 15, 'min_threads' => 1, 'max_threads' => 10, 'max_retries' => 20, 'log_file' => 'skiplock.log', 'log_level' => 'info', 'log_count' => 5, 'log_size' => 10485760, 'namespace' => nil, 'notification' => 'custom', 'extensions' => false, 'purge_completion' => true, 'queues' => { 'default' => 100, 'mailers' => 999 }, 'workers' => 0 }.freeze
|
15
15
|
|
16
16
|
def self.logger=(l)
|
17
17
|
@logger = l
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skiplock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tin Vo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|