Subject: | die with message "Could not connect to servers after 1 attempts" |
Incorrect die "Could not connect to servers after 1 attempts" when server is up.
attached test case output:
no jobs
Could not connect to servers after 1 attempts. at ./test2.pl line 13
In the code $self->{'_connect_retries'} incremented in the next_server() but not decremented or
set to zero any were.
It seems that $self->{'_connect_retries'} = 0 should be done after successful connect.
And anyway 1 attempt is to little, it must be configurable and set to reasonable default (like 10
attempts).
Subject: | test2.pl |
#!/usr/bin/perl
use strict;
use warnings;
use Queue::Beanstalk;
my $jobs = Queue::Beanstalk->new(
servers => [ '127.0.0.1:11300' ],
);
while(1) {
my $data = $jobs->reserve();
unless ($data) {
warn "no jobs\n";
next;
}
warn "job received\n";
$jobs->delete() || warn "can't delete job from queue\n";
}