skiplock 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/skiplock/job.rb +1 -1
- data/lib/skiplock/manager.rb +17 -5
- data/lib/skiplock/version.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: 251899d30b6c22a82be564d61da33bca7734fd67516eec5d6cc122ebde93ccaa
|
4
|
+
data.tar.gz: fa090c287d2f3fcbe03a45a324832d4d5a1fa800e26c26deb40091789c712df5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd62845a436ea37e27da889beecec6f2b16b4d3be745c3d336da4a3a9aacf34867e586e9ecb186e816e9784969dfee754d1fccb3e0ba8dedb8d63fada1eb9304
|
7
|
+
data.tar.gz: ef58e25457ac5ef98c385d122ca3252b161ddf62a589cfefb04286aaec5c2def0f52b6b334e554e8451adfe044f7be7c010a00d9c42a801731e6a7a6b3c5836d
|
data/lib/skiplock/job.rb
CHANGED
@@ -44,7 +44,7 @@ module Skiplock
|
|
44
44
|
Dir.glob('tmp/skiplock/*').each do |f|
|
45
45
|
disposed = true
|
46
46
|
if self.exists?(id: File.basename(f), running: true)
|
47
|
-
job = YAML.
|
47
|
+
job = YAML.respond_to?(:unsafe_load_file) ? YAML.unsafe_load_file(f) : YAML.load_file(f)
|
48
48
|
disposed = job.dispose if job.is_a?(Skiplock::Job)
|
49
49
|
end
|
50
50
|
(File.delete(f) rescue nil) if disposed
|
data/lib/skiplock/manager.rb
CHANGED
@@ -141,17 +141,29 @@ module Skiplock
|
|
141
141
|
|
142
142
|
def setup_logger
|
143
143
|
@config[:loglevel] = 'info' unless ['debug','info','warn','error','fatal','unknown'].include?(@config[:loglevel].to_s)
|
144
|
-
|
144
|
+
if defined?(ActiveSupport::BroadcastLogger)
|
145
|
+
@logger = ActiveSupport::BroadcastLogger.new(::Logger.new(STDOUT))
|
146
|
+
else
|
147
|
+
@logger = ActiveSupport::Logger.new(STDOUT)
|
148
|
+
end
|
145
149
|
@logger.level = @config[:loglevel].to_sym
|
146
150
|
Skiplock.logger = @logger
|
147
151
|
if @config[:logfile].to_s.length > 0
|
148
|
-
|
152
|
+
if defined?(ActiveSupport::BroadcastLogger)
|
153
|
+
@logger.broadcast_to(::Logger.new(File.join(Rails.root, 'log', @config[:logfile].to_s), 'daily'))
|
154
|
+
else
|
155
|
+
@logger.extend(ActiveSupport::Logger.broadcast(::Logger.new(File.join(Rails.root, 'log', @config[:logfile].to_s), 'daily')))
|
156
|
+
end
|
149
157
|
ActiveJob::Base.logger = nil
|
150
158
|
end
|
151
159
|
if @config[:standalone]
|
152
|
-
|
153
|
-
|
154
|
-
|
160
|
+
if defined?(ActiveSupport::BroadcastLogger)
|
161
|
+
Rails.logger = @logger
|
162
|
+
else
|
163
|
+
Rails.logger.reopen('/dev/null') rescue Rails.logger.reopen('NUL') # supports Windows NUL device
|
164
|
+
Rails.logger.level = @logger.level
|
165
|
+
Rails.logger.extend(ActiveSupport::Logger.broadcast(@logger))
|
166
|
+
end
|
155
167
|
end
|
156
168
|
rescue Exception => ex
|
157
169
|
@logger.error "Exception with logger: #{ex.to_s}"
|
data/lib/skiplock/version.rb
CHANGED
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tin Vo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|