diff --git a/lib/AnyEvent/NSQ/Connection.pm b/lib/AnyEvent/NSQ/Connection.pm index 22535b7..099b036 100644 --- a/lib/AnyEvent/NSQ/Connection.pm +++ b/lib/AnyEvent/NSQ/Connection.pm @@ -14,7 +14,6 @@ use Sys::Hostname; # Options from the python client, we might want to support later: # timeout=1.0 # heartbeat_interval=30 -# requeue_delay=90 # tls_v1=False # tls_options=None # snappy=False @@ -25,15 +24,19 @@ use Sys::Hostname; # sample_rate=0 # auth_secret=None + +## Constructor + sub new { my ($class, %args) = @_; my $self = bless( { hostname => hostname(), - connect_timeout => undef, ## use kernel default error_cb => sub { croak(qq{FATAL: error from host '$_[0]->{host}' port $_[0]->{port}: $_[1]}); }, + connect_timeout => undef, ## use kernel default + requeue_delay => 90, }, $class ); diff --git a/lib/AnyEvent/NSQ/Reader.pm b/lib/AnyEvent/NSQ/Reader.pm index 0d9fee5..67b6635 100644 --- a/lib/AnyEvent/NSQ/Reader.pm +++ b/lib/AnyEvent/NSQ/Reader.pm @@ -22,7 +22,7 @@ sub new { $self->{disconnect_cb} = delete($args{disconnect_cb}) || sub { }; $self->{error_cb} = delete($args{error_cb}) || sub { croak($_[1]) }; - for my $arg (qw( ready_count client_id hostname )) { + for my $arg (qw( ready_count client_id hostname requeue_delay )) { $self->{$arg} = delete($args{$arg}) if exists $args{$arg}; } @@ -79,7 +79,7 @@ sub _start_nsqd_connection { croak(qq{FATAL: could not parse '$nsqd_tcp_address' as a valid address/port combination}) unless $host and $port; my %conn = (host => $host, port => $port); - for my $arg (qw( client_id hostname error_cb )) { + for my $arg (qw( client_id hostname error_cb requeue_delay )) { $conn{$arg} = $self->{$arg} if exists $self->{$arg}; }