que 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +7 -6
- data/docs/error_handling.md +0 -4
- data/docs/logging.md +0 -4
- data/docs/managing_workers.md +1 -10
- data/lib/que/sql.rb +1 -1
- data/lib/que/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85eb4ac59563d5e8ca4a6ca6941646b17d747d66
|
4
|
+
data.tar.gz: b028b1087c1b8821e729184aef18be61d7b0f276
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 324b8119b2b5ab4ee7653318aff68667f25ae835feb2928bc1ae522dacbe71f3cb6c493f1014417c25f7565b4fd6594edeeda66c8db7452f285c72226768803a
|
7
|
+
data.tar.gz: f3030170abe60c4da26a155743632b978f224de283d24b071b8ade4232cc8958d1dd9cbef86fbac1aa28682ba3feda8589aabf3a2c7ec4e59a35aec7718d71b8
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
### 0.9.1 (2015-01-11)
|
2
|
+
|
3
|
+
* Use now() rather than 'now' when inserting jobs, to avoid using an old value as the default run_at in prepared statements. (#74) (bgentry)
|
4
|
+
|
1
5
|
### 0.9.0 (2014-12-16)
|
2
6
|
|
3
7
|
* The error_handler callable is now be passed two objects, the error and the job that raised it. If your current error_handler is a proc, as recommended in the docs, you shouldn't need to make any code changes, unless you want to use the job in your error handling. If your error_handler is a lambda, or another callable with a strict arity requirement, you'll want to change it before upgrading. (#69) (statianzo)
|
data/README.md
CHANGED
@@ -96,20 +96,21 @@ You can also add options to run the job after a specific time, or with a specifi
|
|
96
96
|
ChargeCreditCard.enqueue current_user.id, :credit_card_id => card.id, :run_at => 1.day.from_now, :priority => 5
|
97
97
|
```
|
98
98
|
|
99
|
-
To determine what happens when a job is queued, you can set Que's mode
|
99
|
+
To determine what happens when a job is queued, you can set Que's mode. There are a few options for the mode:
|
100
100
|
|
101
|
-
* `
|
102
|
-
* `
|
103
|
-
* `
|
101
|
+
* `Que.mode = :off` - In this mode, queueing a job will simply insert it into the database - the current process will make no effort to run it. You should use this if you want to use a dedicated process to work tasks (there's a rake task to do this, see below). This is the default when running `bin/rails console`.
|
102
|
+
* `Que.mode = :async` - In this mode, a pool of background workers is spun up, each running in their own thread. This is the default when running `bin/rails server`. See the docs for [more information on managing workers](https://github.com/chanks/que/blob/master/docs/managing_workers.md).
|
103
|
+
* `Que.mode = :sync` - In this mode, any jobs you queue will be run in the same thread, synchronously (that is, `MyJob.enqueue` runs the job and won't return until it's completed). This makes your application's behavior easier to test, so it's the default in the test environment.
|
104
104
|
|
105
105
|
If you're using ActiveRecord to dump your database's schema, you'll probably want to [set schema_format to :sql](http://guides.rubyonrails.org/migrations.html#types-of-schema-dumps) so that Que's table structure is managed correctly.
|
106
106
|
|
107
|
-
## Related
|
107
|
+
## Related Projects
|
108
108
|
|
109
109
|
* [que-web](https://github.com/statianzo/que-web) is a Sinatra-based UI for inspecting your job queue.
|
110
110
|
* [que-testing](https://github.com/statianzo/que-testing) allows making assertions on enqueued jobs.
|
111
|
+
* [que-go](https://github.com/bgentry/que-go) is a port of Que for the Go programming language. It uses the same table structure, so that you can use the same job queue from Ruby and Go applications.
|
111
112
|
|
112
|
-
If you have a
|
113
|
+
If you have a project that uses or relates to Que, feel free to submit a PR adding it to the list!
|
113
114
|
|
114
115
|
## Contributing
|
115
116
|
|
data/docs/error_handling.md
CHANGED
@@ -23,7 +23,3 @@ If you're using an error notification system (highly recommended, of course), yo
|
|
23
23
|
Que.error_handler = proc do |error|
|
24
24
|
# Do whatever you want with the error object.
|
25
25
|
end
|
26
|
-
|
27
|
-
# Or, in your Rails configuration:
|
28
|
-
|
29
|
-
config.que.error_handler = proc { |error| ... }
|
data/docs/logging.md
CHANGED
data/docs/managing_workers.md
CHANGED
@@ -12,9 +12,6 @@ You can change the number of workers in the pool whenever you like by setting th
|
|
12
12
|
|
13
13
|
Que.worker_count = 8
|
14
14
|
|
15
|
-
# Or, in your Rails configuration:
|
16
|
-
config.que.worker_count = 8
|
17
|
-
|
18
15
|
### Working Jobs Via Rake Task
|
19
16
|
|
20
17
|
If you don't want to burden your web processes with too much work and want to run workers in a background process instead, similar to how most other queues work, you can:
|
@@ -35,9 +32,6 @@ If your application code is not thread-safe, you won't want any workers to be pr
|
|
35
32
|
|
36
33
|
Que.mode = :off
|
37
34
|
|
38
|
-
# Or, in your Rails configuration:
|
39
|
-
config.que.mode = :off
|
40
|
-
|
41
35
|
This will prevent Que from trying to process jobs in the background of your web processes. In order to actually work jobs, you'll want to run a single worker at a time, and to do so via a separate rake task, like so:
|
42
36
|
|
43
37
|
QUE_WORKER_COUNT=1 rake que:work
|
@@ -46,10 +40,7 @@ This will prevent Que from trying to process jobs in the background of your web
|
|
46
40
|
|
47
41
|
If a worker checks the job queue and finds no jobs ready for it to work, it will fall asleep. In order to make sure that newly-available jobs don't go unworked, a worker is awoken every so often to check for available work. By default, this happens every five seconds, but you can make it happen more or less often by setting a custom wake_interval:
|
48
42
|
|
49
|
-
Que.wake_interval = 2
|
50
|
-
|
51
|
-
# Or, in your Rails configuration:
|
52
|
-
config.que.wake_interval = 2 # 2.seconds also works fine.
|
43
|
+
Que.wake_interval = 2 # In Rails, 2.seconds also works fine.
|
53
44
|
|
54
45
|
You can also choose to never let workers wake up on their own:
|
55
46
|
|
data/lib/que/sql.rb
CHANGED
@@ -60,7 +60,7 @@ module Que
|
|
60
60
|
INSERT INTO que_jobs
|
61
61
|
(queue, priority, run_at, job_class, args)
|
62
62
|
VALUES
|
63
|
-
(coalesce($1, '')::text, coalesce($2, 100)::smallint, coalesce($3,
|
63
|
+
(coalesce($1, '')::text, coalesce($2, 100)::smallint, coalesce($3, now())::timestamptz, $4::text, coalesce($5, '[]')::json)
|
64
64
|
RETURNING *
|
65
65
|
}.freeze,
|
66
66
|
|
data/lib/que/version.rb
CHANGED
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.9.
|
4
|
+
version: 0.9.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:
|
11
|
+
date: 2015-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|