inst-jobs 0.15.7 → 0.15.8

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: 4d91c0b59a62c121e9f6439e2ac280828075aa865a91d800303bedda15d2e6be
4
- data.tar.gz: d5698189dcdb4a275422dc7ec28b128b4f732a4645d5e5c5eab5f207d7fadb4f
3
+ metadata.gz: d1382f66d43fa1610da48ad041f448f968fc7fcbf2ba4a40ac6ecd7478fd9a66
4
+ data.tar.gz: b7346dae4c71daf95b3b26e6d74fbbcaf20fa75678d710a289ce675abe5e06b8
5
5
  SHA512:
6
- metadata.gz: b7c88ad384020f9a1ecf44fc65bef4a8668b6584a26bf1a268791f3e2d42c5a693d68e32a7ae395e78eb0b3e06634ecdd952c571fb108aa145f6df1f431e2e97
7
- data.tar.gz: 58997c5ef5461bb94a7a0732483bac647e4355a2327a91956585cd20b78970bb118aee26fe4c80eb88f81ef3afb758e645dd120ea752be7a1e59a7de9262fe2f
6
+ metadata.gz: d61bc1e00bd03205eeefccec0ccc8c9c955ecea06b371903a42523c6f1590c222e4608c4ffd5b6c7858a8a0367552416e1f79eb96de2794469e409173f355448
7
+ data.tar.gz: 8abae6f577ad0f57f551d7413b11156aa06feb0dfe9ef2d65ed093f17b17a77bdf25fa36ace55811891ba0d3e2d4825c7f7e738ce92e8f5b921f811dd68a353c
@@ -45,7 +45,7 @@ module Delayed
45
45
  # > Multiple queries sent in a single PQexec call are processed in a single transaction,
46
46
  # unless there are explicit BEGIN/COMMIT commands included in the query string to divide
47
47
  # it into multiple transactions.
48
- sql = "SELECT pg_advisory_xact_lock(#{connection.quote_table_name('half_md5_as_bigint')}(#{connection.quote(values['strand'])})); #{sql}" if attributes["strand"]
48
+ sql = "SELECT pg_advisory_xact_lock(#{connection.quote_table_name('half_md5_as_bigint')}(#{connection.quote(values['strand'])})); #{sql}" if values["strand"]
49
49
  result = connection.execute(sql, "#{self} Create")
50
50
  job.id = result.values.first.first
51
51
  result.clear
@@ -1,3 +1,3 @@
1
1
  module Delayed
2
- VERSION = "0.15.7"
2
+ VERSION = "0.15.8"
3
3
  end
@@ -267,11 +267,26 @@ describe 'Delayed::Backed::ActiveRecord::Job' do
267
267
  skip "Requires Rails 5.2 or greater" unless Rails.version >= '5.2'
268
268
 
269
269
  allow(Delayed::Job.connection).to receive(:prepared_statements).and_return(false)
270
- allow(Delayed::Job.connection).to receive(:execute).and_call_original.once
270
+ allow(Delayed::Job.connection).to receive(:execute).with(be_include("pg_advisory_xact_lock"), anything).and_call_original.once
271
271
  allow(Delayed::Job.connection).to receive(:insert).never
272
272
  j = create_job(strand: "test1")
273
273
  allow(Delayed::Job.connection).to receive(:execute).and_call_original
274
274
  expect(Delayed::Job.find(j.id)).to eq j
275
275
  end
276
+
277
+ it "creates a non-stranded job in a single statement" do
278
+ skip "Requires Rails 5.2 or greater" unless Rails.version >= '5.2'
279
+
280
+ allow(Delayed::Job.connection).to receive(:prepared_statements).and_return(false)
281
+ call_count = 0
282
+ allow(Delayed::Job.connection).to receive(:execute).and_wrap_original do |m, (arg1, arg2)|
283
+ call_count += 1
284
+ m.call(arg1, arg2)
285
+ end
286
+ allow(Delayed::Job.connection).to receive(:insert).never
287
+ j = create_job(strand: "test1")
288
+ expect(call_count).to eq 1
289
+ expect(Delayed::Job.find(j.id)).to eq j
290
+ end
276
291
  end
277
292
  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.7
4
+ version: 0.15.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke