beetle 3.4.3 → 3.5.0
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.
- checksums.yaml +4 -4
 - data/RELEASE_NOTES.rdoc +3 -0
 - data/lib/beetle/client.rb +7 -0
 - data/lib/beetle/publisher.rb +7 -3
 - data/lib/beetle/version.rb +1 -1
 - data/test/beetle/client_test.rb +6 -0
 - data/test/beetle/publisher_test.rb +27 -7
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: cb4bee36ae48b68aa27483c59aea588aa1a263c7c33858738ce6471246e1bb96
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 93f380bb4596fcabfc48bec927ba7767b04b826750c307934ed937023c7a8152
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 34d0e2001a1f93f8b88a86992a77bda65acddc1913c550798144c62fc11b77b7da0dcc0b0c270edd38aa7d27b7ea5f1d0f03fe2a955154db0f91759f5aaa2aee
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 7ee1364e4fc0e6c6d8cefb1f10c5d4baa0fa6c7a1bd1434a710169538d104b4b83016faa3fb3bb6616bbae1c1db668953f24acd9c342d481b20b6e5d41c967de
         
     | 
    
        data/RELEASE_NOTES.rdoc
    CHANGED
    
    
    
        data/lib/beetle/client.rb
    CHANGED
    
    | 
         @@ -280,6 +280,13 @@ module Beetle 
     | 
|
| 
       280 
280 
     | 
    
         
             
                  publisher.throttled?
         
     | 
| 
       281 
281 
     | 
    
         
             
                end
         
     | 
| 
       282 
282 
     | 
    
         | 
| 
      
 283 
     | 
    
         
            +
                # set up queues and policies for all configured queues. Otherwise this will
         
     | 
| 
      
 284 
     | 
    
         
            +
                # happen on first use of an exchange, which can be undesired for latency
         
     | 
| 
      
 285 
     | 
    
         
            +
                # sensitive endpoints. Only needs to be called once.
         
     | 
| 
      
 286 
     | 
    
         
            +
                def setup_queues_and_policies
         
     | 
| 
      
 287 
     | 
    
         
            +
                  publisher.setup_queues_and_policies
         
     | 
| 
      
 288 
     | 
    
         
            +
                end
         
     | 
| 
      
 289 
     | 
    
         
            +
             
     | 
| 
       283 
290 
     | 
    
         
             
                # traces queues without consuming them. useful for debugging message flow.
         
     | 
| 
       284 
291 
     | 
    
         
             
                def trace(queue_names=self.queues.keys, tracer=nil, &block)
         
     | 
| 
       285 
292 
     | 
    
         
             
                  queues_to_trace = self.queues.slice(*queue_names)
         
     | 
    
        data/lib/beetle/publisher.rb
    CHANGED
    
    | 
         @@ -169,10 +169,14 @@ module Beetle 
     | 
|
| 
       169 
169 
     | 
    
         
             
                  end
         
     | 
| 
       170 
170 
     | 
    
         
             
                end
         
     | 
| 
       171 
171 
     | 
    
         | 
| 
       172 
     | 
    
         
            -
                def setup_queues_and_policies 
     | 
| 
      
 172 
     | 
    
         
            +
                def setup_queues_and_policies
         
     | 
| 
       173 
173 
     | 
    
         
             
                  each_server do
         
     | 
| 
       174 
     | 
    
         
            -
                     
     | 
| 
       175 
     | 
    
         
            -
                       
     | 
| 
      
 174 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 175 
     | 
    
         
            +
                      @client.queues.keys.each do |name|
         
     | 
| 
      
 176 
     | 
    
         
            +
                        queue(name)
         
     | 
| 
      
 177 
     | 
    
         
            +
                      end
         
     | 
| 
      
 178 
     | 
    
         
            +
                    rescue => e
         
     | 
| 
      
 179 
     | 
    
         
            +
                      logger.warn "Beetle: failed setting up queues and policies on #{@server}: #{e}"
         
     | 
| 
       176 
180 
     | 
    
         
             
                    end
         
     | 
| 
       177 
181 
     | 
    
         
             
                  end
         
     | 
| 
       178 
182 
     | 
    
         
             
                end
         
     | 
    
        data/lib/beetle/version.rb
    CHANGED
    
    
    
        data/test/beetle/client_test.rb
    CHANGED
    
    | 
         @@ -282,6 +282,12 @@ module Beetle 
     | 
|
| 
       282 
282 
     | 
    
         
             
                  client.stop_publishing
         
     | 
| 
       283 
283 
     | 
    
         
             
                end
         
     | 
| 
       284 
284 
     | 
    
         | 
| 
      
 285 
     | 
    
         
            +
                test "should delegate setup_queues_and_policies to the publisher instance" do
         
     | 
| 
      
 286 
     | 
    
         
            +
                  client = Client.new
         
     | 
| 
      
 287 
     | 
    
         
            +
                  client.send(:publisher).expects(:setup_queues_and_policies)
         
     | 
| 
      
 288 
     | 
    
         
            +
                  client.setup_queues_and_policies
         
     | 
| 
      
 289 
     | 
    
         
            +
                end
         
     | 
| 
      
 290 
     | 
    
         
            +
             
     | 
| 
       285 
291 
     | 
    
         
             
                test "should delegate queue purging to the publisher instance" do
         
     | 
| 
       286 
292 
     | 
    
         
             
                  client = Client.new
         
     | 
| 
       287 
293 
     | 
    
         
             
                  client.register_queue(:queue)
         
     | 
| 
         @@ -355,14 +355,34 @@ module Beetle 
     | 
|
| 
       355 
355 
     | 
    
         
             
                end
         
     | 
| 
       356 
356 
     | 
    
         | 
| 
       357 
357 
     | 
    
         
             
                test "setting up queues and policies should iterate over all servers" do
         
     | 
| 
       358 
     | 
    
         
            -
                   
     | 
| 
       359 
     | 
    
         
            -
                   
     | 
| 
      
 358 
     | 
    
         
            +
                  client = Client.new
         
     | 
| 
      
 359 
     | 
    
         
            +
                  client.register_queue("queue")
         
     | 
| 
      
 360 
     | 
    
         
            +
                  pub = Publisher.new(client)
         
     | 
| 
      
 361 
     | 
    
         
            +
                  pub.servers = %w(a b)
         
     | 
| 
      
 362 
     | 
    
         
            +
             
     | 
| 
       360 
363 
     | 
    
         
             
                  s = sequence("setup")
         
     | 
| 
       361 
     | 
    
         
            -
                   
     | 
| 
       362 
     | 
    
         
            -
                   
     | 
| 
       363 
     | 
    
         
            -
                   
     | 
| 
       364 
     | 
    
         
            -
                   
     | 
| 
       365 
     | 
    
         
            -
                   
     | 
| 
      
 364 
     | 
    
         
            +
                  pub.expects(:set_current_server).with("a").in_sequence(s)
         
     | 
| 
      
 365 
     | 
    
         
            +
                  pub.expects(:queue).with(client.config.beetle_policy_updates_queue_name).in_sequence(s)
         
     | 
| 
      
 366 
     | 
    
         
            +
                  pub.expects(:queue).with("queue").in_sequence(s)
         
     | 
| 
      
 367 
     | 
    
         
            +
                  pub.expects(:set_current_server).with("b").in_sequence(s)
         
     | 
| 
      
 368 
     | 
    
         
            +
                  pub.expects(:queue).with(client.config.beetle_policy_updates_queue_name).in_sequence(s)
         
     | 
| 
      
 369 
     | 
    
         
            +
                  pub.expects(:queue).with("queue").in_sequence(s)
         
     | 
| 
      
 370 
     | 
    
         
            +
             
     | 
| 
      
 371 
     | 
    
         
            +
                  pub.setup_queues_and_policies()
         
     | 
| 
      
 372 
     | 
    
         
            +
                end
         
     | 
| 
      
 373 
     | 
    
         
            +
             
     | 
| 
      
 374 
     | 
    
         
            +
                test "setting up queues and policies should handle ephemeral errors" do
         
     | 
| 
      
 375 
     | 
    
         
            +
                  client = Client.new
         
     | 
| 
      
 376 
     | 
    
         
            +
                  pub = Publisher.new(client)
         
     | 
| 
      
 377 
     | 
    
         
            +
                  client.register_queue("queue")
         
     | 
| 
      
 378 
     | 
    
         
            +
                  pub.servers = %w(a b)
         
     | 
| 
      
 379 
     | 
    
         
            +
                  pub.stubs(:queue).raises(StandardError)
         
     | 
| 
      
 380 
     | 
    
         
            +
             
     | 
| 
      
 381 
     | 
    
         
            +
                  s = sequence("setup")
         
     | 
| 
      
 382 
     | 
    
         
            +
                  pub.expects(:set_current_server).with("a").in_sequence(s)
         
     | 
| 
      
 383 
     | 
    
         
            +
                  pub.expects(:set_current_server).with("b").in_sequence(s)
         
     | 
| 
      
 384 
     | 
    
         
            +
             
     | 
| 
      
 385 
     | 
    
         
            +
                  pub.setup_queues_and_policies()
         
     | 
| 
       366 
386 
     | 
    
         
             
                end
         
     | 
| 
       367 
387 
     | 
    
         | 
| 
       368 
388 
     | 
    
         
             
                test "reports whether it has been throttled" do
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: beetle
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.5.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Stefan Kaes
         
     | 
| 
         @@ -12,7 +12,7 @@ authors: 
     | 
|
| 
       12 
12 
     | 
    
         
             
            autorequire:
         
     | 
| 
       13 
13 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       14 
14 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       15 
     | 
    
         
            -
            date: 2021-01- 
     | 
| 
      
 15 
     | 
    
         
            +
            date: 2021-01-22 00:00:00.000000000 Z
         
     | 
| 
       16 
16 
     | 
    
         
             
            dependencies:
         
     | 
| 
       17 
17 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       18 
18 
     | 
    
         
             
              name: bunny
         
     |