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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ebc3d59d7709f435ee1f2ecb3773b0f8d64361c80c01a23c8a4a4bd89972874
4
- data.tar.gz: 8f3a5cbdbfe91b9ef61207a4655552363b9a0fdd4d8caf29c1c6e83c7135f80e
3
+ metadata.gz: 251899d30b6c22a82be564d61da33bca7734fd67516eec5d6cc122ebde93ccaa
4
+ data.tar.gz: fa090c287d2f3fcbe03a45a324832d4d5a1fa800e26c26deb40091789c712df5
5
5
  SHA512:
6
- metadata.gz: a4d693051b2bfc567ccd1407ea26f8105ab3997e2e75452fdb037c0b2bd8d235c0075a320703e0c0b0ed77d2f326bcbf1efebdf87f0a3df82c9bee23111011d0
7
- data.tar.gz: 2554c0c9449429890fcdd7614791cae475e3ede8299c70df87ed94857a2ec165e89d1770d70e226cd0f06db8ae4d49d523de377e536043f6bf8f98da5a21aa2b
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.load_file(f) rescue nil
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
@@ -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
- @logger = ActiveSupport::BroadcastLogger.new(::Logger.new(STDOUT))
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
- @logger.broadcast_to(::Logger.new(File.join(Rails.root, 'log', @config[:logfile].to_s), 'daily'))
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
- Rails.logger.reopen('/dev/null') rescue Rails.logger.reopen('NUL') # supports Windows NUL device
153
- Rails.logger.level = @logger.level
154
- Rails.logger.extend(ActiveSupport::Logger.broadcast(@logger))
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}"
@@ -1,4 +1,4 @@
1
1
  module Skiplock
2
- VERSION = Version = '1.1.4'
2
+ VERSION = Version = '1.1.5'
3
3
  end
4
4
 
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
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-10-24 00:00:00.000000000 Z
11
+ date: 2023-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob