que 0.12.0 → 0.12.1

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
  SHA1:
3
- metadata.gz: dd0f74eb9d94a2f949174b802fdd70f898cfe2e3
4
- data.tar.gz: 60c5ea6a16dd1080bc16fcea19250c01e94937f6
3
+ metadata.gz: ec4ff01c0a08ebea8aef1fd75f2948ddabd49794
4
+ data.tar.gz: b5a5ab2a2276606a5b9b2252690aa97bbaacaf9e
5
5
  SHA512:
6
- metadata.gz: fdc55d830dccfb0eaed7b7220b2bb65a239b0abda3b7cbd749cd87f7835fc6e521db375ef749e0a3f216f82620b6e76fc6dd6edf3b44c5d80f35feb8a43324ea
7
- data.tar.gz: cecc9a9a728cf2445ffc4fed02c050972e8903cd4639594b069252e10f130c8dc96ea7bf2305c81f7a2b3e045e416d13198c3009cc08074d4545ebd232ef1f18
6
+ metadata.gz: 443ffec355bf4e0ff62734ee6ebf6c5e7665396f98e426696efedeb7b32c556aa7b8976893f799f05ba974c3cdf3509f7f1cf3dea19ddec72ee956879d96ad5c
7
+ data.tar.gz: 0bdafbc30cb5b538290d9cf1387fbceebd00d2e62d6e89546228f59b7c81e450d825ebb21856142ba11a348b147e3a8be9e751af50b262c64844496d4e3cedde
data/.travis.yml CHANGED
@@ -5,8 +5,11 @@ rvm:
5
5
  - "2.1"
6
6
  - "2.2"
7
7
  - "2.3"
8
+ - "2.4"
8
9
  - "rbx-2"
9
- - "jruby-1.7.5"
10
+ - "rbx"
11
+ - "jruby-1.7"
12
+ - "jruby"
10
13
  before_script:
11
14
  - psql -c 'create database "que-test"' -U postgres
12
15
  - bundle exec ruby -r sequel -r ./lib/que -e 'Que.connection=Sequel.connect("postgres://localhost/que-test"); Que.migrate!'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.12.1 (2017-01-22)
2
+
3
+ * Fix incompatibility with Rails 5.0. (#166) (nbibler, thedarkone)
4
+
1
5
  ### 0.12.0 (2016-09-09)
2
6
 
3
7
  * The error_handler configuration option has been renamed to error_notifier, which is more descriptive of what it's actually supposed to do. You can still use error_handler for configuration, but you'll get a warning.
data/lib/que.rb CHANGED
@@ -84,7 +84,13 @@ module Que
84
84
  end
85
85
 
86
86
  def worker_states
87
- execute :worker_states
87
+ adapter.checkout do |conn|
88
+ if conn.server_version >= 90600
89
+ execute :worker_states_96
90
+ else
91
+ execute :worker_states_95
92
+ end
93
+ end
88
94
  end
89
95
 
90
96
  # Give us a cleaner interface when specifying a job_class as a string.
@@ -59,7 +59,16 @@ module Que
59
59
  private
60
60
 
61
61
  def checkout_activerecord_adapter(&block)
62
- ::ActiveRecord::Base.connection_pool.with_connection(&block)
62
+ # Use Rails' executor (if present) to make sure that the connection
63
+ # we're using isn't taken from us while the block runs. See
64
+ # https://github.com/chanks/que/issues/166#issuecomment-274218910
65
+ if defined?(Rails.application.executor)
66
+ Rails.application.executor.wrap do
67
+ ::ActiveRecord::Base.connection_pool.with_connection(&block)
68
+ end
69
+ else
70
+ ::ActiveRecord::Base.connection_pool.with_connection(&block)
71
+ end
63
72
  end
64
73
  end
65
74
  end
data/lib/que/sql.rb CHANGED
@@ -131,7 +131,7 @@ module Que
131
131
  ORDER BY count(*) DESC
132
132
  }.freeze,
133
133
 
134
- :worker_states => %{
134
+ :worker_states_95 => %{
135
135
  SELECT que_jobs.*,
136
136
  pg.pid AS pg_backend_pid,
137
137
  pg.state AS pg_state,
@@ -147,6 +147,24 @@ module Que
147
147
  JOIN pg_stat_activity USING (pid)
148
148
  WHERE locktype = 'advisory'
149
149
  ) pg USING (job_id)
150
- }.freeze
150
+ }.freeze,
151
+
152
+ :worker_states_96 => %{
153
+ SELECT que_jobs.*,
154
+ pg.pid AS pg_backend_pid,
155
+ pg.state AS pg_state,
156
+ pg.state_change AS pg_state_changed_at,
157
+ pg.query AS pg_last_query,
158
+ pg.query_start AS pg_last_query_started_at,
159
+ pg.xact_start AS pg_transaction_started_at,
160
+ pg.wait_event_type IS NOT NULL AS pg_waiting_on_lock
161
+ FROM que_jobs
162
+ JOIN (
163
+ SELECT (classid::bigint << 32) + objid::bigint AS job_id, pg_stat_activity.*
164
+ FROM pg_locks
165
+ JOIN pg_stat_activity USING (pid)
166
+ WHERE locktype = 'advisory'
167
+ ) pg USING (job_id)
168
+ }.freeze,
151
169
  }.freeze
152
170
  end
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.12.0'
4
+ Version = '0.12.1'
5
5
  end
data/spec/spec_helper.rb CHANGED
@@ -5,6 +5,7 @@ require 'uri'
5
5
  require 'pg'
6
6
  require 'logger'
7
7
  require 'json'
8
+ require 'pry'
8
9
 
9
10
  Dir['./spec/support/**/*.rb'].sort.each &method(:require)
10
11
 
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.12.0
4
+ version: 0.12.1
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-09-09 00:00:00.000000000 Z
11
+ date: 2017-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler