[libanyevent-rabbitmq-perl] 110/151: Properly handle channel close: Ensure pending requests fail immediately
Damyan Ivanov
dmn at moszumanska.debian.org
Thu Jan 16 11:03:08 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 662691404ddc125f531601b0ddb2c5320a85f7e2
Author: Chip Salzenberg <chip at topsy.com>
Date: Sun Aug 26 17:49:03 2012 -0700
Properly handle channel close: Ensure pending requests fail immediately
---
lib/AnyEvent/RabbitMQ/Channel.pm | 2 ++
lib/AnyEvent/RabbitMQ/LocalQueue.pm | 10 ++++++++++
2 files changed, 12 insertions(+)
diff --git a/lib/AnyEvent/RabbitMQ/Channel.pm b/lib/AnyEvent/RabbitMQ/Channel.pm
index 0bfbbe6..bae38ff 100644
--- a/lib/AnyEvent/RabbitMQ/Channel.pm
+++ b/lib/AnyEvent/RabbitMQ/Channel.pm
@@ -598,6 +598,8 @@ sub push_queue_or_consume {
);
$self->{_is_open} = 0;
$self->{_is_active} = 0;
+ $self->{_queue}->_flush($frame);
+ $self->{_content_queue}->_flush($frame);
$self->{connection}->delete_channel($self->{id});
$self->{on_close}->($frame);
return $self;
diff --git a/lib/AnyEvent/RabbitMQ/LocalQueue.pm b/lib/AnyEvent/RabbitMQ/LocalQueue.pm
index 9a1463f..b2e838c 100644
--- a/lib/AnyEvent/RabbitMQ/LocalQueue.pm
+++ b/lib/AnyEvent/RabbitMQ/LocalQueue.pm
@@ -45,5 +45,15 @@ sub _drain_queue {
return $self;
}
+sub _flush {
+ my ($self, $frame) = @_;
+
+ $self->_drain_queue;
+
+ while (my $cb = shift @{$self->{_drain_code_queue}}) {
+ eval { $cb->($frame) };
+ }
+}
+
1;
--
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