mimi-messaging 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99d219b26de0275984ae4a58a8ad2e87558db4a3
4
- data.tar.gz: 2eb4e88a3bedabc884dd57eff6d9afe8971cbf45
3
+ metadata.gz: 59db6d2cf3e038d1cacc7ef50576e82d8372d042
4
+ data.tar.gz: b7f802bf48fb24f18e65bcd4c6fcfc17ed6bc0bc
5
5
  SHA512:
6
- metadata.gz: 30b69c9b1945d0a65a3541d469034c36aac02769e95a276ade278bd26f9a1872d6e58ffbc0bd84c0387bd666f1fd293dda364fec73ee5d15b7f5c11b11f68b5e
7
- data.tar.gz: 871493f0e32e1d2aeb488e875558ad192c065e105a785707180e67a76953680bcd68264e904fb9bfe77151e2733b907a423ef4851fae7d2c2bb1c338a6f428c4
6
+ metadata.gz: cc08d35ccde1feb2bddd3a7920eab1384f111996d3a0137cf18a83e90bcfb669e20d57ac111e2dfbacb2fd4ece1f06044649dc35cfbaeff06e6955ebd3eb7735
7
+ data.tar.gz: 66432175a64cdb90f020c9b5a82aa51d8c58ebfeb01c581ea567e189c600f329e73b63944c35b024e3a42b1fb1b9890f17281d7c152ee210f156104f7c90bc85
@@ -46,22 +46,30 @@ module Mimi
46
46
  raise "#{name} already started" if started?
47
47
  logger.debug "#{self} starting to serve '#{resource_name}' (#{exposed_methods})"
48
48
  @queue = construct_queue
49
- @consumer = @queue.subscribe(manual_ack: true) do |d, m, p|
50
- begin
51
- new(d, m, p)
52
- rescue StandardError => e
53
- logger.error e.to_s
54
- logger.debug e.backtrace.join("\n")
55
- ensure
56
- @consumer.channel.ack(d.delivery_tag) if @consumer.channel && @consumer.channel.active
49
+ @consumer_mutex = Mutex.new
50
+ @consumer_mutex.synchronize do
51
+ @consumer = @queue.subscribe(manual_ack: true) do |d, m, p|
52
+ begin
53
+ new(d, m, p)
54
+ rescue StandardError => e
55
+ logger.error e.to_s
56
+ logger.debug e.backtrace.join("\n")
57
+ ensure
58
+ @consumer_mutex.synchronize do
59
+ @consumer.channel.ack(d.delivery_tag) if @consumer.channel && @consumer.channel.active
60
+ end
61
+ end
57
62
  end
58
63
  end
64
+ # consumer created, mutex released
59
65
  end
60
66
 
61
67
  def self.stop
62
68
  return if abstract?
63
69
  raise "#{name} already stopped" unless started?
64
- @consumer.cancel if @consumer
70
+ @consumer_mutex.synchronize do
71
+ @consumer.cancel if @consumer
72
+ end
65
73
  @consumer = nil
66
74
  @queue = nil
67
75
  @channel = nil
@@ -1,5 +1,5 @@
1
1
  module Mimi
2
2
  module Messaging
3
- VERSION = '0.1.3'.freeze
3
+ VERSION = '0.1.4'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mimi-messaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Kukushkin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-10 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mimi-core