celerb 0.3.1 → 0.3.2

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.
@@ -7,7 +7,7 @@ require 'msgpack'
7
7
  require 'uuid'
8
8
 
9
9
  module Celerb
10
- VERSION = '0.3.1'
10
+ VERSION = '0.3.2'
11
11
  end
12
12
 
13
13
  require 'celerb/task'
@@ -1,7 +1,8 @@
1
1
  module Celerb
2
2
  class ResultConsumer
3
3
 
4
- def initialize
4
+ def initialize channel
5
+ @channel = channel
5
6
  @handlers = {}
6
7
  EM.add_periodic_timer(60) do
7
8
  now = Time.now
@@ -33,7 +34,7 @@ module Celerb
33
34
  end
34
35
 
35
36
  def task_id_to_queue(task_id)
36
- MQ.queue(task_id.delete('-'), :auto_delete => true)
37
+ @channel.queue(task_id.delete('-'), :auto_delete => true)
37
38
  end
38
39
 
39
40
  end
@@ -2,9 +2,10 @@ module Celerb
2
2
  class TaskPublisher
3
3
 
4
4
  def self.connect(opts)
5
- @exchange = AMQP::Channel.direct(opts[:exchange],
5
+ channel = AMQP::Channel.new
6
+ @exchange = channel.direct(opts[:exchange],
6
7
  :key => opts[:key], :durable => true)
7
- @results = ResultConsumer.new
8
+ @results = ResultConsumer.new(channel)
8
9
  end
9
10
 
10
11
  def self.delay_task(task_name, task_args=[], task_kwargs={},
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: celerb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dusan Maliarik