[libanyevent-rabbitmq-perl] 143/151: allow AMQP client to adjust tuning, e.g. heartbeat

Damyan Ivanov dmn at moszumanska.debian.org
Thu Jan 16 11:03:11 UTC 2014


This is an automated email from the git hooks/post-receive script.

dmn pushed a commit to annotated tag debian/1.12-1
in repository libanyevent-rabbitmq-perl.

commit 05a46f0f13d1cfa65b51e6f8e31fbdc4786d9a78
Author: Chip Salzenberg <chip at topsy.com>
Date:   Mon Mar 25 23:27:55 2013 -0700

    allow AMQP client to adjust tuning, e.g. heartbeat
---
 lib/AnyEvent/RabbitMQ.pm | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/lib/AnyEvent/RabbitMQ.pm b/lib/AnyEvent/RabbitMQ.pm
index e6e397a..e1c5eed 100644
--- a/lib/AnyEvent/RabbitMQ.pm
+++ b/lib/AnyEvent/RabbitMQ.pm
@@ -292,20 +292,20 @@ sub _tune {
         sub {
             my $frame = shift;
 
+            my %tune = map { my $t = $args{tune}{$_};
+                             ( $_ => defined($t) ? $t : $frame->method_frame->$_ ) }
+                          qw( channel_max frame_max heartbeat );
+
             $self->_push_write(
-                Net::AMQP::Protocol::Connection::TuneOk->new(
-                    channel_max => $frame->method_frame->channel_max,
-                    frame_max   => $frame->method_frame->frame_max,
-                    heartbeat   => $frame->method_frame->heartbeat,
-                ),
+                Net::AMQP::Protocol::Connection::TuneOk->new(%tune)
             );
 
             $self->_open(%args,);
 
-            if ($frame->method_frame->heartbeat > 0) {
+            if ($tune{heartbeat} > 0) {
                 $self->{_heartbeat} = AnyEvent->timer(
-                    after => $frame->method_frame->heartbeat,
-                    interval => $frame->method_frame->heartbeat,
+                    after    => $tune{heartbeat},
+                    interval => $tune{heartbeat},
                     cb => sub {
                         $self->_push_write(Net::AMQP::Frame::Heartbeat->new());
                     },
@@ -600,6 +600,7 @@ AnyEvent::RabbitMQ - An asynchronous and multi channel Perl AMQP client.
       vhost      => '/',
       timeout    => 1,
       tls        => 0, # Or 1 if you'd like SSL
+      tune       => { heartbeat => 30, channel_max => $whatever, frame_max = $whatever },
       on_success => sub {
           $ar->open_channel(
               on_success => sub {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libanyevent-rabbitmq-perl.git



More information about the Pkg-perl-cvs-commits mailing list