inst-jobs 0.15.19 → 0.15.20

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: 988fd063fdecd8a94025cf8b9d1db853e3397ab3842942928cbdc99e241d0d80
4
- data.tar.gz: c20258789ad05909efe3125e70a34bceb2a124398e43dbdf7d4b3c3d6dadf8ab
3
+ metadata.gz: 17a98186a4f5f1038958a84bfc19884179c91d2afc5ec92f6e61967ab76dceb0
4
+ data.tar.gz: bfacc6d2201f5a5e7741f793b8042cb5c32434254ec82dcf76003e3dae539c2d
5
5
  SHA512:
6
- metadata.gz: e5f688d3413484f51c93270aea753178915ed38cdd3081dba5816621b070a99cea9c5bd518757db43ced1607a651241f8cd62f5160f5ea53cf113a7df3cab8c7
7
- data.tar.gz: fb563b85cc6b7caaef52e63342f00ce06ad0d30c75a3adaa47b7f8e81565a77610e4c3fc7aea7b3af1c703ea9e5f5e80c8801cf7ec4dc0cd10569cae57ebfcde
6
+ metadata.gz: 18bbbbc13154cd9dc95a26f2fe3e3c3cc30759740c049c85e65b5de1ed4e2dd28130685f86b50139889fd493785ad513dd55f1023cb845f8cb98bbdf866b55c3
7
+ data.tar.gz: 3d7cf731a725967f7b99066c7a330f266450541782e5aef0962d6832a8a0eda56119b36ffe9bb4dc3e22c0be02fafc8383366763dfe6425cfc392bbeade1e28e
@@ -377,7 +377,9 @@ module Delayed
377
377
  def self.transaction_for_singleton(strand, on_conflict)
378
378
  return yield if on_conflict == :loose
379
379
  self.transaction do
380
- connection.execute(sanitize_sql(["SELECT pg_advisory_xact_lock(#{connection.quote_table_name('half_md5_as_bigint')}(?))", strand]))
380
+ function = on_conflict == :patient ? 'pg_try_advisory_xact_lock' : 'pg_advisory_xact_lock'
381
+ result = connection.select_value(sanitize_sql(["SELECT #{function}(#{connection.quote_table_name('half_md5_as_bigint')}(?))", strand]))
382
+ return if result == false && on_conflict == :patient
381
383
  yield
382
384
  end
383
385
  end
@@ -396,7 +398,7 @@ module Delayed
396
398
  new_job.initialize_defaults
397
399
  job.run_at =
398
400
  case on_conflict
399
- when :use_earliest
401
+ when :use_earliest, :patient
400
402
  [job.run_at, new_job.run_at].min
401
403
  when :overwrite
402
404
  new_job.run_at
@@ -47,7 +47,10 @@ class Periodic
47
47
  end
48
48
 
49
49
  def enqueue
50
- Delayed::Job.enqueue(self, @job_args.merge(:max_attempts => 1, :run_at => @cron.next_time(Delayed::Periodic.now).utc.to_time, :singleton => tag))
50
+ Delayed::Job.enqueue(self, @job_args.merge(:max_attempts => 1,
51
+ :run_at => @cron.next_time(Delayed::Periodic.now).utc.to_time,
52
+ :singleton => tag,
53
+ on_conflict: :patient))
51
54
  end
52
55
 
53
56
  def perform
@@ -1,3 +1,3 @@
1
1
  module Delayed
2
- VERSION = "0.15.19"
2
+ VERSION = "0.15.20"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inst-jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.19
4
+ version: 0.15.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-04-13 00:00:00.000000000 Z
12
+ date: 2020-04-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord