queue_classic 4.0.0.pre.alpha1 → 4.0.0.pre.beta1
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 +4 -4
- data/.circleci/config.yml +51 -10
- data/README.md +17 -2
- data/lib/queue_classic/conn_adapter.rb +1 -1
- data/lib/queue_classic/queue.rb +1 -1
- data/lib/queue_classic/version.rb +1 -1
- data/queue_classic.gemspec +1 -0
- data/test/lib/queue_classic_test_with_activerecord_typecast.rb +21 -0
- metadata +25 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e57fa8cff0c8e6772dda85c9e4a83c5b851f3dc4e5093d36d53b5607bdad99c
|
4
|
+
data.tar.gz: '06691d8784eaed7f920319e1e413d2ac0fde11797673726022ee4c99713e7687'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58822f3b1458c8ee9f10c8e54784a357b48cfee4ee7bd8dae0b722a0ba2a21f2e994f20df58b7160627a0c210d03f616598c92d314afd763773fbb1b784472d2
|
7
|
+
data.tar.gz: 30c9691284a280ef1efd234a9a404f97421349b620b083aaefa0d2350f6f8a079b980610a1cd787cf05c04ffadc935bc16c9f3f199cdc685de585b84f18b9198
|
data/.circleci/config.yml
CHANGED
@@ -3,7 +3,7 @@ jobs:
|
|
3
3
|
test_fresh_install_rails_5_2_3:
|
4
4
|
parallelism: 2
|
5
5
|
docker:
|
6
|
-
- image: circleci/ruby:2.6
|
6
|
+
- image: circleci/ruby:2.6
|
7
7
|
environment:
|
8
8
|
RAILS_ENV: test
|
9
9
|
RACK_ENV: test
|
@@ -21,9 +21,9 @@ jobs:
|
|
21
21
|
command: |
|
22
22
|
cd test/rails-tests/
|
23
23
|
sh rails523.sh
|
24
|
-
|
24
|
+
test_ruby_2_4:
|
25
25
|
docker:
|
26
|
-
- image: circleci/ruby:2.4
|
26
|
+
- image: circleci/ruby:2.4
|
27
27
|
environment:
|
28
28
|
RAILS_ENV: test
|
29
29
|
RACK_ENV: test
|
@@ -61,9 +61,9 @@ jobs:
|
|
61
61
|
path: test/reports/
|
62
62
|
- store_test_results:
|
63
63
|
path: test/reports/
|
64
|
-
|
64
|
+
test_ruby_2_5:
|
65
65
|
docker:
|
66
|
-
- image: circleci/ruby:2.5
|
66
|
+
- image: circleci/ruby:2.5
|
67
67
|
environment:
|
68
68
|
RAILS_ENV: test
|
69
69
|
RACK_ENV: test
|
@@ -101,9 +101,49 @@ jobs:
|
|
101
101
|
path: test/reports/
|
102
102
|
- store_test_results:
|
103
103
|
path: test/reports/
|
104
|
-
|
104
|
+
test_ruby_2_6:
|
105
105
|
docker:
|
106
|
-
- image: circleci/ruby:2.6
|
106
|
+
- image: circleci/ruby:2.6
|
107
|
+
environment:
|
108
|
+
RAILS_ENV: test
|
109
|
+
RACK_ENV: test
|
110
|
+
POSTGRES_USER: root
|
111
|
+
PGHOST: 127.0.0.1
|
112
|
+
DATABASE_URL: postgres://postgres@127.0.0.1/circle_test
|
113
|
+
QC_DATABASE_URL: postgres://postgres@127.0.0.1/circle_test
|
114
|
+
QC_BENCHMARK: true
|
115
|
+
QC_BENCHMARK_MAX_TIME_DEQUEUE: 60
|
116
|
+
- image: circleci/postgres:9.6.6-alpine
|
117
|
+
steps:
|
118
|
+
- checkout
|
119
|
+
- run:
|
120
|
+
name: Install env dependencies
|
121
|
+
command: |
|
122
|
+
sudo apt-get update
|
123
|
+
sudo apt-get install postgresql-client
|
124
|
+
- restore_cache:
|
125
|
+
key: v1-qc-bundler-{{ checksum "Gemfile" }}-{{ checksum "queue_classic.gemspec"
|
126
|
+
}}
|
127
|
+
- run:
|
128
|
+
name: Install Ruby gems
|
129
|
+
command: |
|
130
|
+
bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
|
131
|
+
- save_cache:
|
132
|
+
key: v1-qc-bundler-{{ checksum "Gemfile" }}-{{ checksum "queue_classic.gemspec"
|
133
|
+
}}
|
134
|
+
paths:
|
135
|
+
- ~/project/vendor/bundle
|
136
|
+
- run:
|
137
|
+
name: Minitest
|
138
|
+
command: |
|
139
|
+
bundle exec rake
|
140
|
+
- store_artifacts:
|
141
|
+
path: test/reports/
|
142
|
+
- store_test_results:
|
143
|
+
path: test/reports/
|
144
|
+
test_ruby_2_7:
|
145
|
+
docker:
|
146
|
+
- image: circleci/ruby:2.7
|
107
147
|
environment:
|
108
148
|
RAILS_ENV: test
|
109
149
|
RACK_ENV: test
|
@@ -145,7 +185,8 @@ workflows:
|
|
145
185
|
version: 2
|
146
186
|
test:
|
147
187
|
jobs:
|
148
|
-
-
|
149
|
-
-
|
150
|
-
-
|
188
|
+
- test_ruby_2_4
|
189
|
+
- test_ruby_2_5
|
190
|
+
- test_ruby_2_6
|
191
|
+
- test_ruby_2_7
|
151
192
|
- test_fresh_install_rails_5_2_3
|
data/README.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# queue_classic
|
2
|
-
A simple, efficient worker queue for Ruby & PostgreSQL
|
2
|
+
A simple, efficient worker queue for Ruby & PostgreSQL.
|
3
|
+
|
4
|
+
Why this over something like Resque. Two reasons:
|
5
|
+
|
6
|
+
1. Your jobs can be equeued in the same transaction as other modifications to the database, and will only be processed when everything is commited. This is a hard pattern to develop around for queues done outside your database
|
7
|
+
2. Less things to run, if you don't already have Redis or a dedicated queue in your stack.
|
3
8
|
|
4
9
|
[](https://circleci.com/gh/QueueClassic/queue_classic/tree/master)
|
5
10
|
|
@@ -11,6 +16,16 @@ You can always find the latest and previous releases here:
|
|
11
16
|
|
12
17
|
https://github.com/QueueClassic/queue_classic/releases
|
13
18
|
|
19
|
+
## Other related projects
|
20
|
+
|
21
|
+
If you're interested in this project, you might also want to checkout:
|
22
|
+
|
23
|
+
* [Que](https://github.com/que-rb/que)
|
24
|
+
* [GoodJob](https://github.com/bensheldon/good_job)
|
25
|
+
* [Delayed Job](https://github.com/collectiveidea/delayed_job)
|
26
|
+
|
27
|
+
For a list of other queues (which may or may not be Postgres backed), checkout - https://edgeapi.rubyonrails.org/classes/ActiveJob/QueueAdapters.html
|
28
|
+
|
14
29
|
## What is queue_classic?
|
15
30
|
|
16
31
|
queue_classic provides a simple interface to a PostgreSQL-backed message queue. queue_classic specializes in concurrent locking and minimizing database load while providing a simple, intuitive developer experience. queue_classic assumes that you are already using PostgreSQL in your production environment and that adding another dependency (e.g. redis, beanstalkd, 0mq) is undesirable.
|
@@ -34,7 +49,7 @@ A major benefit is the ability to enqueue inside transactions, ensuring things a
|
|
34
49
|
### Requirements
|
35
50
|
|
36
51
|
For this version, the requirements are as follows:
|
37
|
-
* Ruby 2.4, 2.5 or 2.
|
52
|
+
* Ruby 2.4, 2.5, 2.6 or 2.7
|
38
53
|
* Postgres ~> 9.6
|
39
54
|
* Rubygem: pg ~> 0.17
|
40
55
|
|
data/lib/queue_classic/queue.rb
CHANGED
@@ -117,7 +117,7 @@ module QC
|
|
117
117
|
job[:method] = r["method"]
|
118
118
|
job[:args] = JSON.parse(r["args"])
|
119
119
|
if r["scheduled_at"]
|
120
|
-
job[:scheduled_at] = Time.parse(r["scheduled_at"])
|
120
|
+
job[:scheduled_at] = r["scheduled_at"].kind_of?(Time) ? r["scheduled_at"] : Time.parse(r["scheduled_at"])
|
121
121
|
ttl = Integer((Time.now - job[:scheduled_at]) * 1000)
|
122
122
|
QC.measure("time-to-lock=#{ttl}ms source=#{name}")
|
123
123
|
end
|
data/queue_classic.gemspec
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.expand_path("../../helper.rb", __FILE__)
|
4
|
+
|
5
|
+
class QueueClassicTest < QCTest
|
6
|
+
def before_teardown
|
7
|
+
ActiveRecord.send :remove_const, :Base
|
8
|
+
Object.send :remove_const, :ActiveRecord
|
9
|
+
|
10
|
+
QC.default_conn_adapter = @original_conn_adapter
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_lock_with_active_record_timestamp_type_cast
|
14
|
+
# Insert an unlocked job
|
15
|
+
p_queue = QC::Queue.new("priority_queue")
|
16
|
+
conn_adapter = Minitest::Mock.new
|
17
|
+
conn_adapter.expect(:execute, {"id" => '1', "q_name" => 'test', "method" => "Kernel.puts", "args" => "[]", "scheduled_at" => Time.now}, [String, String])
|
18
|
+
QC.default_conn_adapter = conn_adapter
|
19
|
+
assert_equal(p_queue.lock, {})
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: queue_classic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.pre.
|
4
|
+
version: 4.0.0.pre.beta1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Smith (♠ ace hacker)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|
@@ -30,6 +30,26 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '2.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: activerecord
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 5.0.0
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '6.1'
|
43
|
+
type: :development
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 5.0.0
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '6.1'
|
33
53
|
description: queue_classic is a queueing library for Ruby apps. (Rails, Sinatra, Etc...)
|
34
54
|
queue_classic features asynchronous job polling, database maintained locks and no
|
35
55
|
ridiculous dependencies. As a matter of fact, queue_classic only requires pg.
|
@@ -78,6 +98,7 @@ files:
|
|
78
98
|
- test/helper.sql
|
79
99
|
- test/lib/queue_classic_rails_connection_test.rb
|
80
100
|
- test/lib/queue_classic_test.rb
|
101
|
+
- test/lib/queue_classic_test_with_activerecord_typecast.rb
|
81
102
|
- test/queue_test.rb
|
82
103
|
- test/rails-tests/.gitignore
|
83
104
|
- test/rails-tests/rails523.sh
|
@@ -101,8 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
122
|
- !ruby/object:Gem::Version
|
102
123
|
version: 1.3.1
|
103
124
|
requirements: []
|
104
|
-
|
105
|
-
rubygems_version: 2.7.6
|
125
|
+
rubygems_version: 3.1.2
|
106
126
|
signing_key:
|
107
127
|
specification_version: 4
|
108
128
|
summary: Simple, efficient worker queue for Ruby & PostgreSQL.
|
@@ -113,6 +133,7 @@ test_files:
|
|
113
133
|
- test/helper.sql
|
114
134
|
- test/lib/queue_classic_rails_connection_test.rb
|
115
135
|
- test/lib/queue_classic_test.rb
|
136
|
+
- test/lib/queue_classic_test_with_activerecord_typecast.rb
|
116
137
|
- test/queue_test.rb
|
117
138
|
- test/rails-tests/.gitignore
|
118
139
|
- test/rails-tests/rails523.sh
|