queue_classic 0.3.7.pre → 1.0.0.rc1

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.
@@ -50,7 +50,7 @@ module QC
50
50
 
51
51
  def wait_for_notify(t)
52
52
  log("waiting for notify timeout=#{t}")
53
- connection.wait_for_notify(t)
53
+ connection.wait_for_notify(t) {|event, pid, msg| log("received notification #{event}")}
54
54
  log("done waiting for notify")
55
55
  end
56
56
 
@@ -8,6 +8,7 @@ module QC
8
8
 
9
9
  def <<(details)
10
10
  execute("INSERT INTO #{@table_name} (details) VALUES ('#{JSON.dump(details)}')")
11
+ @database.notify if ENV["QC_LISTENING_WORKER"] == "true"
11
12
  end
12
13
 
13
14
  def count
@@ -113,7 +113,7 @@ module QC
113
113
  if can_listen?
114
114
  log("worker waiting on LISTEN")
115
115
  @queue.database.listen
116
- @queue.database.wait_for_notify(t) { log("message received") }
116
+ @queue.database.wait_for_notify(t)
117
117
  @queue.database.unlisten
118
118
  @queue.database.drain_notify
119
119
  log("worker finished LISTEN")
data/readme.md CHANGED
@@ -1,15 +1,16 @@
1
- # Queue Classic
2
- __0.3.2__ (beta)
1
+ # queue_classic
2
+ v1.0.0
3
3
 
4
- Queue Classic is a postgres-backed queueing library that is focused on
4
+ queue_classic is a PostgreSQL-backed queueing library that is focused on
5
5
  concurrent job locking, minimizing database load & providing a simple &
6
6
  intuitive user experience.
7
7
 
8
- Queue Classic Features:
8
+ queue_classic features:
9
9
 
10
10
  * Support for multiple queues with heterogeneous workers
11
- * Utilization of Postgres' PUB/SUB
11
+ * Utilization of Postgres' PUB/SUB
12
12
  * JSON encoding for jobs
13
+ * Forking workers
13
14
  * Postgres' rock-solid locking mechanism
14
15
  * Long term support
15
16
 
@@ -17,27 +18,34 @@ Queue Classic Features:
17
18
 
18
19
  See doc/installation.md for Rails instructions
19
20
 
20
- $ gem install queue_classic
21
- psql=# CREATE TABLE queue_classic_jobs (id serial, details text, locked_at timestamp);
22
- psql=# CREATE INDEX queue_classic_jobs_id_idx ON queue_classic_jobs (id);
23
- $ rake qc:load_functions
24
- irb: QC.enqueue "Class.method", "arg"
25
- $ rake jobs:work
21
+ ```bash
22
+ $ createdb queue_classic_test
23
+ $ psql queue_classic_test
24
+ psql=# CREATE TABLE queue_classic_jobs (id serial, details text, locked_at timestamp);
25
+ psql=# CREATE INDEX queue_classic_jobs_id_idx ON queue_classic_jobs (id);
26
+ $ export QC_DATABASE_URL="postgres://username:password@localhost/queue_classic_test"
27
+ $ gem install queue_classic
28
+ $ ruby -r queue_classic -e "QC::Database.new.load_functions"
29
+ $ ruby -r queue_classic -e "QC.enqueue("Kernel.puts", "hello world")"
30
+ $ ruby -r queue_classic -e "QC::Worker.new.start"
31
+ ```
26
32
 
27
- ## Hacking on Queue Classic
33
+ ## Hacking on queue_classic
28
34
 
29
35
  ### Dependencies
30
36
 
31
- * Postgres version 9
32
- * Ruby
33
- * Gems: pg, json
37
+ * Ruby 1.9.2
38
+ * Postgres ~> 9.0
39
+ * Rubygems: pg ~> 0.11.0
34
40
 
35
41
  ### Running Tests
36
42
 
37
- * Install dependencies: pg, json (see gemspec)
38
- * createdb queue_classic_test
39
- * export DATABASE_URL="postgres://username:pass@localhost/queue_classic_test"
40
- * rake will run the tests (or turn test/)
43
+ ```bash
44
+ $ bundle
45
+ $ createdb queue_classic_test
46
+ $ export QC_DATABASE_URL="postgres://username:pass@localhost/queue_classic_test"
47
+ $ rake
48
+ ```
41
49
 
42
50
  ### Building Documentation
43
51
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: queue_classic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7.pre
4
+ version: 1.0.0.rc1
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-08-22 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pg
16
- requirement: &2152255440 !ruby/object:Gem::Requirement
16
+ requirement: &2156924400 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,11 +21,10 @@ dependencies:
21
21
  version: 0.11.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2152255440
25
- description: Queue Classic (beta) is a queueing library for Ruby apps (Rails, Sinatra,
26
- Etc...) Queue Classic features asynchronous job polling, database maintained locks
27
- and no ridiculous dependencies. As a matter of fact, Queue Classic only requires
28
- the pg and json.
24
+ version_requirements: *2156924400
25
+ description: queue_classic is a queueing library for Ruby apps. (Rails, Sinatra, Etc...)
26
+ queue_classic features asynchronous job polling, database maintained locks and no
27
+ ridiculous dependencies. As a matter of fact, queue_classic only requires pg.
29
28
  email: ryan@heroku.com
30
29
  executables: []
31
30
  extensions: []
@@ -70,10 +69,7 @@ rubyforge_project:
70
69
  rubygems_version: 1.8.7
71
70
  signing_key:
72
71
  specification_version: 3
73
- summary: Queue Classic (beta) is a queueing library for Ruby apps (Rails, Sinatra,
74
- Etc...) Queue Classic features asynchronous job polling, database maintained locks
75
- and no ridiculous dependencies. As a matter of fact, Queue Classic only requires
76
- the pg and json.(simple)
72
+ summary: postgres backed queue
77
73
  test_files:
78
74
  - test/database_test.rb
79
75
  - test/durable_array_test.rb