queue_classic 2.0.0rc4 → 2.0.0rc5

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,7 +7,7 @@ namespace :qc do
7
7
  desc "Start a new worker for the (default or $QUEUE) queue"
8
8
  task :work => :environment do
9
9
  QC::Worker.new(
10
- QC::TABLE_NAME,
10
+ QC::QUEUE,
11
11
  QC::TOP_BOUND,
12
12
  QC::FORK_WORKER,
13
13
  QC::LISTENING_WORKER,
@@ -18,7 +18,7 @@ namespace :qc do
18
18
  desc "Returns the number of jobs in the (default or QUEUE) queue"
19
19
  task :length => :environment do
20
20
  puts QC::Worker.new(
21
- QC::TABLE_NAME,
21
+ QC::QUEUE,
22
22
  QC::TOP_BOUND,
23
23
  QC::FORK_WORKER,
24
24
  QC::LISTENING_WORKER,
@@ -32,7 +32,7 @@ namespace :qc do
32
32
  end
33
33
 
34
34
  desc "Remove queue_classic functions from database."
35
- task :load_functions => :environment do
35
+ task :drop_functions => :environment do
36
36
  QC::Queries.drop_functions
37
37
  end
38
38
  end
@@ -5,7 +5,7 @@ module QC
5
5
  log("worker initialized")
6
6
  @running = true
7
7
 
8
- @queue = Queue.new(q_name)
8
+ @queue = Queue.new(q_name, listening_worker)
9
9
  log("worker queue=#{@queue.name}")
10
10
 
11
11
  @top_bound = top_bound
@@ -126,9 +126,9 @@ module QC
126
126
  def wait(t)
127
127
  if can_listen?
128
128
  log("worker waiting on LISTEN")
129
- Conn.listen
129
+ Conn.listen(@queue.chan)
130
130
  Conn.wait_for_notify(t)
131
- Conn.unlisten
131
+ Conn.unlisten(@queue.chan)
132
132
  Conn.drain_notify
133
133
  log("worker finished LISTEN")
134
134
  else
data/readme.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # queue_classic
2
2
 
3
- v2.0.0rc2
3
+ v2.0.0rc4
4
4
 
5
5
  queue_classic is a PostgreSQL-backed queueing library that is focused on
6
6
  concurrent job locking, minimizing database load & providing a simple &
@@ -30,7 +30,7 @@ distribute jobs to worker processes, then queue_classic is exactly what you need
30
30
 
31
31
  The Heroku Postgres team uses queue_classic to monitor the health of
32
32
  customer databases. They process 200 jobs per second using a [fugu](https://postgres.heroku.com/pricing)
33
- database. They chose queue_classic because of it's simplicity and reliability.
33
+ database. They chose queue_classic because of its simplicity and reliability.
34
34
 
35
35
  ### Cloudapp
36
36
 
@@ -93,7 +93,7 @@ class CreateJobsTable < ActiveRecord::Migration
93
93
 
94
94
  def self.up
95
95
  create_table :queue_classic_jobs do |t|
96
- t.strict :q_name
96
+ t.string :q_name
97
97
  t.string :method
98
98
  t.text :args
99
99
  t.timestamp :locked_at
@@ -320,7 +320,7 @@ worker.start
320
320
  ##### General Idea
321
321
 
322
322
  The worker class (QC::Worker) is designed to be extended via inheritance. Any of
323
- it's methods should be considered for extension. There are a few in particular
323
+ its methods should be considered for extension. There are a few in particular
324
324
  that act as stubs in hopes that the user will override them. Such methods
325
325
  include: `handle_failure() and setup_child()`. See the section near the bottom
326
326
  for a detailed descriptor of how to subclass the worker.
@@ -75,6 +75,15 @@ class WorkerTest < QCTest
75
75
  assert_equal(0, worker.failed_count)
76
76
  end
77
77
 
78
+ def test_worker_listens_on_chan
79
+ p_queue = QC::Queue.new("priority_queue")
80
+ p_queue.enqueue("TestObject.two_args", "1", 2)
81
+ worker = TestWorker.new("priority_queue", 1, false, true, 1)
82
+ r = worker.work
83
+ assert_equal(["1", 2], r)
84
+ assert_equal(0, worker.failed_count)
85
+ end
86
+
78
87
  def test_worker_ueses_one_conn
79
88
  QC.enqueue("TestObject.no_args")
80
89
  worker = TestWorker.new("default", 1, false, false, 1)
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: 2.0.0rc4
4
+ version: 2.0.0rc5
5
5
  prerelease: 5
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pg
16
- requirement: &8948440 !ruby/object:Gem::Requirement
16
+ requirement: &25213420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 0.13.2
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *8948440
24
+ version_requirements: *25213420
25
25
  description: queue_classic is a queueing library for Ruby apps. (Rails, Sinatra, Etc...)
26
26
  queue_classic features asynchronous job polling, database maintained locks and no
27
27
  ridiculous dependencies. As a matter of fact, queue_classic only requires pg.