queue_classic_plus 4.0.0.alpha12 → 4.0.0.alpha14

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: 53bcc9820afd73035eac622633277005186232b40cee67736b6e7365dc00ccee
4
- data.tar.gz: cfcb45c257cc50fdbeca8dd594aba7b0387ad6e210f7a1a314022488aae885cf
3
+ metadata.gz: 02d3b91c1e5eb2b3cd87c4431123bcdcd83546352a101a70d88663914cae8b75
4
+ data.tar.gz: 2bae8d97dc7e05144fb5d398fafefb870aa0f476ea0d82cd595a26378ca16f75
5
5
  SHA512:
6
- metadata.gz: 9bbd716d0c1a11645745f4929543bac35220db15e9bd76baf9677643cb5f66138ed7cc1a9c040d0bcfa91b57bb9afb84042339759e1a687c2bcdff805e14861e
7
- data.tar.gz: ec310250c95292616e98e894ece699f6dc10adb7824684d0cfd209f56146c4b49f3d7ee32a37763a52947af7af8c05a7c0568a20327db22936ffe7f3328771ca
6
+ metadata.gz: b536eafcf6c8a7fd0698a09a9f56b3bd944612df546c857f69784269472cba64a555c639cf856c6811bffdb0037b851d8fb73a3e661785ab295b8b2143408dd7
7
+ data.tar.gz: f9cc374b667dfdb79f9adba615aab35bd49e2f90fda74eec04681d4f6288547235baba2b676abd118f51d227a436a6a571a8fd758f3828db15cf7436fff93073
data/Gemfile CHANGED
@@ -5,7 +5,6 @@ gemspec
5
5
 
6
6
  gem "queue_classic_matchers", github: 'rainforestapp/queue_classic_matchers'
7
7
  gem 'pry'
8
- gem 'dry-configurable'
9
8
 
10
9
  group :development do
11
10
  gem "guard-rspec", require: false
data/README.md CHANGED
@@ -126,7 +126,7 @@ end
126
126
 
127
127
  ## Advanced configuration
128
128
 
129
- If you want to log exceptions in your favorite exception tracker. You can configured it like sso:
129
+ If you want to log exceptions in your favorite exception tracker. You can configured it like so:
130
130
 
131
131
  ```ruby
132
132
  QueueClassicPlus.exception_handler = -> (exception, job) do
@@ -142,20 +142,26 @@ Push metrics to your metric provider (only Librato is supported for now).
142
142
  QueueClassicPlus.update_metrics
143
143
  ```
144
144
 
145
- Call this is a cron job or something similar.
145
+ Call this in a cron job or something similar.
146
146
 
147
- If you are using NewRelic and want to push performance data to it, you can add this to an initializer:
147
+ If you are using New Relic and want to push performance data to it, you can add this to an initializer:
148
148
 
149
149
  ```ruby
150
150
  require "queue_classic_plus/new_relic"
151
151
  ```
152
152
 
153
- To instrument DataDog monitoring add this to your QC initializer:
153
+ To instrument Datadog monitoring add this to your QC initializer:
154
154
 
155
155
  ```ruby
156
156
  require "queue_classic_plus/datadog"
157
157
  ```
158
158
 
159
+ The Datadog service name defaults to `qc.job`. This can be changed in the initializer:
160
+
161
+ ```ruby
162
+ QueueClassicDatadog.config.dd_service = "custom_service_name"
163
+ ```
164
+
159
165
  ## Contributing
160
166
 
161
167
  1. Fork it ( https://github.com/[my-github-username]/queue_classic_plus/fork )
@@ -172,4 +178,7 @@ createdb queue_classic_plus_test
172
178
 
173
179
  ## Releasing
174
180
 
175
- Releasing is done in CircleCI via the `push_to_rubygems`, triggered by pushing a tagged commit. To do so, simply [create a new GitHub release](https://github.com/rainforestapp/queue_classic_plus/releases/new).
181
+ Releasing is done in CircleCI via the `push_to_rubygems`, triggered by pushing a tagged commit.
182
+ You can create a new `tag` while [creating a new GitHub release](https://github.com/rainforestapp/queue_classic_plus/releases/new).
183
+
184
+ _** Note: The `tag` is what publishes a new version of the gem. The `release` is purely for documentation._
@@ -6,6 +6,10 @@ module QueueClassicPlus
6
6
  QC::Queue.new(@queue)
7
7
  end
8
8
 
9
+ def self.queue_name_digest
10
+ @queue_name_digest ||= @queue.to_s.to_i(36)
11
+ end
12
+
9
13
  inheritable_attr :locked
10
14
  inheritable_attr :skip_transaction
11
15
  inheritable_attr :retries_on
@@ -75,8 +79,12 @@ module QueueClassicPlus
75
79
  end
76
80
 
77
81
  def self.enqueue(method, *args)
78
- if can_enqueue?(method, *args)
79
- queue.enqueue(method, *serialized(args))
82
+ conn = QC.default_conn_adapter.connection
83
+ conn.transaction do
84
+ conn.exec("SELECT pg_advisory_xact_lock(#{queue_name_digest})")
85
+ if can_enqueue?(method, *args)
86
+ queue.enqueue(method, *serialized(args))
87
+ end
80
88
  end
81
89
  end
82
90
 
@@ -1,3 +1,3 @@
1
1
  module QueueClassicPlus
2
- VERSION = '4.0.0.alpha12'.freeze
2
+ VERSION = '4.0.0.alpha14'.freeze
3
3
  end
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "queue_classic", "4.0.0.pre.alpha1"
22
+ spec.add_dependency "dry-configurable", "1.1.0"
22
23
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0')
23
24
  spec.add_development_dependency "bundler", "~> 1.6"
24
25
  else
data/spec/base_spec.rb CHANGED
@@ -12,9 +12,15 @@ describe QueueClassicPlus::Base do
12
12
  end
13
13
 
14
14
  it "does not allow multiple enqueues" do
15
- subject.do
16
- subject.do
17
- expect(subject).to have_queue_size_of(1)
15
+ threads = []
16
+ 50.times do
17
+ threads << Thread.new do
18
+ subject.do
19
+ expect(subject).to have_queue_size_of(1)
20
+ end
21
+ end
22
+
23
+ threads.each(&:join)
18
24
  end
19
25
 
20
26
  it "checks for an existing job using the same serializing as job enqueuing" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: queue_classic_plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.alpha12
4
+ version: 4.0.0.alpha14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Mathieu
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-08-01 00:00:00.000000000 Z
13
+ date: 2023-08-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: queue_classic
@@ -26,6 +26,20 @@ dependencies:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
28
  version: 4.0.0.pre.alpha1
29
+ - !ruby/object:Gem::Dependency
30
+ name: dry-configurable
31
+ requirement: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - '='
34
+ - !ruby/object:Gem::Version
35
+ version: 1.1.0
36
+ type: :runtime
37
+ prerelease: false
38
+ version_requirements: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - '='
41
+ - !ruby/object:Gem::Version
42
+ version: 1.1.0
29
43
  - !ruby/object:Gem::Dependency
30
44
  name: bundler
31
45
  requirement: !ruby/object:Gem::Requirement