que 0.11.5 → 0.11.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0c2982677c2d3e3149550edd34a8c0740784f87
4
- data.tar.gz: 8a7c53ddf56279a7f5eb520af3e8b36492503181
3
+ metadata.gz: 1d29adfcb566361924bbd594ba6e5c7b93006060
4
+ data.tar.gz: 65905d420760dcafc00411f895d6140262d9beb1
5
5
  SHA512:
6
- metadata.gz: 736ef950176ef1ae58317be47d28ce1dda34d7cd8599f517de2b67efcfb7f6987aa5ba0ea680eeeebcc3cf51591763fc5ad39c774500abdc58079f049b88de67
7
- data.tar.gz: da960c013f059e71aa1f96c7b1e485002a27719cfcb06966c62a6eeaf8d2837b25a09b02251003ef2c133707a8ef4413a96029b1acfb34ac69cb6e22d37f189a
6
+ metadata.gz: 729dcc64222ed6c9c1d528e72ad4195a9b66aa2275372143f0add9ad051977e967dad6b5dbced2dec86a714553a2994fe2e12e4a2f03224751e2d9670f97d05b
7
+ data.tar.gz: 1ffb694bd34229a657e203256e85556b9e84bc293681e71cbb80d98cbf21003651d0d9b80d67f34f0849f2f863743a8d08a5bb24a24e7ae6ed7ec7eaa3f149fb
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.11.6 (2016-07-01)
2
+
3
+ * Fix for operating in nested transactions in Rails 5.0. (#160) (greysteil)
4
+
1
5
  ### 0.11.5 (2016-05-13)
2
6
 
3
7
  * Fix error when running `que -v`. (#154) (hardbap)
data/docs/README.md CHANGED
@@ -1,33 +1,33 @@
1
1
  Docs Index
2
- ==============
2
+ ===============
3
3
 
4
- - [Advanced Setup](docs/advanced_setup.md)
5
- - Using ActiveRecord Without Rails
6
- - Forking Servers
7
- - Managing the Jobs Table
8
- - Other Setup
9
- - [Customizing Que](docs/customizing_que.md)
10
- - Recurring Jobs
11
- - DelayedJob-style Jobs
12
- - QueueClassic-style Jobs
13
- - Retaining Finished Jobs
14
- - Not Retrying Certain Failed Jobs
15
- - [Error Handling](docs/error_handling.md)
16
- - [Inspecting the Queue](docs/inspecting_the_queue.md)
17
- - Job Stats
18
- - Worker States
19
- - Custom Queries
20
- - [Logging](docs/logging.md)
21
- - [Managing Workers](docs/managing_workers.md)
22
- - Working Jobs Via Executable
23
- - Thread-Unsafe Application Code
24
- - The Wake Interval
25
- - Manually Waking Workers
26
- - Connection Pool Size
27
- - [Migrating](docs/migrating.md)
28
- - [Multiple Queues](docs/multiple_queues.md)
29
- - [Shutting Down Safely](docs/shutting_down_safely.md)
30
- - [Using Plain Postgres Connections](docs/using_plain_connections.md)
31
- - [Using Sequel](docs/using_sequel.md)
32
- - [Writing Reliable Jobs](docs/writing_reliable_jobs.md)
33
- - Timeouts
4
+ - [Advanced Setup](advanced_setup.md#advanced-setup)
5
+ - [Using ActiveRecord Without Rails](advanced_setup.md#using-activerecord-without-rails)
6
+ - [Forking Servers](advanced_setup.md#forking-servers)
7
+ - [Managing the Jobs Table](advanced_setup.md#managing-the-jobs-table)
8
+ - [Other Setup](advanced_setup.md#other-setup)
9
+ - [Customizing Que](customizing_que.md#customizing-que)
10
+ - [Recurring Jobs](customizing_que.md#recurring-jobs)
11
+ - [DelayedJob-style Jobs](customizing_que.md#delayedjob-style-jobs)
12
+ - [QueueClassic-style Jobs](customizing_que.md#queueclassic-style-jobs)
13
+ - [Retaining Finished Jobs](customizing_que.md#retaining-finished-jobs)
14
+ - [Not Retrying Certain Failed Jobs](customizing_que.md#not-retrying-certain-failed-jobs)
15
+ - [Error Handling](error_handling.md#error-handling)
16
+ - [Inspecting the Queue](inspecting_the_queue.md#inspecting-the-queue)
17
+ - [Job Stats](inspecting_the_queue.md#job-stats)
18
+ - [Worker States](inspecting_the_queue.md#worker-states)
19
+ - [Custom Queries](inspecting_the_queue.md#custom-queries)
20
+ - [Logging](logging.md#logging)
21
+ - [Managing Workers](managing_workers.md#managing-workers)
22
+ - [Working Jobs Via Executable](managing_workers.md#working-jobs-via-executable)
23
+ - [Thread-Unsafe Application Code](managing_workers.md#thread-unsafe-application-code)
24
+ - [The Wake Interval](managing_workers.md#the-wake-interval)
25
+ - [Manually Waking Workers](managing_workers.md#manually-waking-workers)
26
+ - [Connection Pool Size](managing_workers.md#connection-pool-size)
27
+ - [Migrating](migrating.md#migrating)
28
+ - [Multiple Queues](multiple_queues.md#multiple-queues)
29
+ - [Shutting Down Safely](shutting_down_safely.md#shutting-down-safely)
30
+ - [Using Plain Postgres Connections](using_plain_connections.md#using-plain-postgres-connections)
31
+ - [Using Sequel](using_sequel.md#using-sequel)
32
+ - [Writing Reliable Jobs](writing_reliable_jobs.md#writing-reliable-jobs)
33
+ - [Timeouts](writing_reliable_jobs.md#timeouts)
@@ -46,6 +46,14 @@ module Que
46
46
  def before_committed!(*)
47
47
  # no-op
48
48
  end
49
+
50
+ def add_to_transaction
51
+ # no-op.
52
+ #
53
+ # This is called when we're in a nested transaction. Ideally we would
54
+ # `wake!` when the outer transaction gets committed, but that would be
55
+ # a bigger refactor!
56
+ end
49
57
  end
50
58
 
51
59
  private
data/lib/que/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Que
4
- Version = '0.11.5'
4
+ Version = '0.11.6'
5
5
  end
@@ -6,7 +6,7 @@ unless defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
6
6
  require 'spec_helper'
7
7
  require 'active_record'
8
8
 
9
- if ActiveRecord.version.release >= Gem::Version.new('4.2')
9
+ if ActiveRecord.version.release >= Gem::Version.new('4.2') && ActiveRecord.version.release < Gem::Version.new('5.0')
10
10
  ActiveRecord::Base.raise_in_transactional_callbacks = true
11
11
  end
12
12
  ActiveRecord::Base.establish_connection(QUE_URL)
@@ -103,12 +103,24 @@ unless defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
103
103
  Que::Job.enqueue
104
104
  sleep_until { Que::Worker.workers.all?(&:sleeping?) && DB[:que_jobs].empty? }
105
105
 
106
+ # Wakes a worker on transaction commit when in a transaction.
106
107
  ActiveRecord::Base.transaction do
107
108
  Que::Job.enqueue
108
109
  Que::Worker.workers.each { |worker| worker.should be_sleeping }
109
110
  end
110
111
  sleep_until { Que::Worker.workers.all?(&:sleeping?) && DB[:que_jobs].empty? }
111
112
 
113
+ # Does nothing when in a nested transaction.
114
+ # TODO: ideally this would wake after the outer transaction commits
115
+ if ActiveRecord.version.release >= Gem::Version.new('5.0')
116
+ ActiveRecord::Base.transaction do
117
+ ActiveRecord::Base.transaction(requires_new: true) do
118
+ Que::Job.enqueue
119
+ Que::Worker.workers.each { |worker| worker.should be_sleeping }
120
+ end
121
+ end
122
+ end
123
+
112
124
  # Do nothing when queueing with a specific :run_at.
113
125
  BlockJob.enqueue :run_at => Time.now
114
126
  Que::Worker.workers.each { |worker| worker.should be_sleeping }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: que
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.5
4
+ version: 0.11.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Hanks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-13 00:00:00.000000000 Z
11
+ date: 2016-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler