Skip to content

Commit

Permalink
Prepare 0.8 release, limit connection rate
Browse files Browse the repository at this point in the history
  • Loading branch information
leedo committed Feb 22, 2010
1 parent f1bf84a commit fc52424
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 51 deletions.
2 changes: 2 additions & 0 deletions README.pod
Expand Up @@ -129,6 +129,8 @@ Ryan Baumann

Paul Robins E<lt>alice@mon.gsE<gt>

Clint Ecker

=head1 COPYRIGHT

Copyright 2009 by Lee Aylward E<lt>leedo@cpan.orgE<gt>
Expand Down
2 changes: 1 addition & 1 deletion lib/App/Alice.pm
Expand Up @@ -11,7 +11,7 @@ use App::Alice::Logger;
use Any::Moose;
use File::Copy;

our $VERSION = '0.06';
our $VERSION = '0.08';

has cond => (
is => 'rw',
Expand Down
2 changes: 2 additions & 0 deletions lib/App/Alice.pod
Expand Up @@ -129,6 +129,8 @@ Ryan Baumann

Paul Robins E<lt>alice@mon.gsE<gt>

Clint Ecker

=head1 COPYRIGHT

Copyright 2009 by Lee Aylward E<lt>leedo@cpan.orgE<gt>
Expand Down
8 changes: 7 additions & 1 deletion lib/App/Alice/IRC.pm
Expand Up @@ -47,7 +47,7 @@ has 'reconnect_timer' => (
is => 'rw'
);

has 'reconnect_count' => (
has [qw/reconnect_count connect_time/] => (
is => 'rw',
isa => 'Int',
default => 0,
Expand Down Expand Up @@ -182,6 +182,7 @@ sub connected {
}
else {
$self->reset_reconnect_count;
$self->connect_time(time);
$self->is_connected(1);
}
}
Expand All @@ -192,6 +193,11 @@ sub reconnect {
$self->log_info("too many failed reconnects, giving up");
return;
}
my $interval = time - $self->connect_time;
if ($interval < 30) {
$time = 30 - $interval;
$self->log_info("last attempt was within 30 seconds, delaying $time seconds")
}
$time = 60 unless $time >= 0;
$self->log_info("reconnecting in $time seconds");
$self->reconnect_timer(
Expand Down
Binary file removed share/log.db
Binary file not shown.
49 changes: 0 additions & 49 deletions share/proxy.psgi

This file was deleted.

0 comments on commit fc52424

Please sign in to comment.