summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Echolot/Commands.pm10
-rw-r--r--Echolot/Scheduler.pm21
-rw-r--r--NEWS4
-rw-r--r--debian/changelog6
-rwxr-xr-xpingd14
5 files changed, 34 insertions, 21 deletions
diff --git a/Echolot/Commands.pm b/Echolot/Commands.pm
index c0a6b59..6c6901c 100644
--- a/Echolot/Commands.pm
+++ b/Echolot/Commands.pm
@@ -1,7 +1,7 @@
package Echolot::Commands;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Commands.pm,v 1.9 2002/07/17 17:53:44 weasel Exp $
+# $Id: Commands.pm,v 1.10 2002/08/23 07:54:53 weasel Exp $
#
=pod
@@ -68,13 +68,13 @@ sub processCommands($) {
} elsif ($command eq 'set') {
Echolot::Globals::get()->{'storage'}->set_stuff(@args);
} elsif ($command eq 'getkeyconf') {
- Echolot::Globals::get()->{'scheduler'}->schedule('getkeyconf', time(), \@args );
+ Echolot::Globals::get()->{'scheduler'}->schedule('getkeyconf', 0, time(), \@args );
} elsif ($command eq 'buildstats') {
- Echolot::Globals::get()->{'scheduler'}->schedule('buildstats', time() );
+ Echolot::Globals::get()->{'scheduler'}->schedule('buildstats', 0, time() );
} elsif ($command eq 'buildkeys') {
- Echolot::Globals::get()->{'scheduler'}->schedule('buildkeys', time() );
+ Echolot::Globals::get()->{'scheduler'}->schedule('buildkeys', 0, time() );
} elsif ($command eq 'buildthesaurus') {
- Echolot::Globals::get()->{'scheduler'}->schedule('buildthesaurus', time() );
+ Echolot::Globals::get()->{'scheduler'}->schedule('buildthesaurus', 0, time() );
} elsif ($command eq 'delete') {
Echolot::Globals::get()->{'storage'}->delete_remailer(@args);
} elsif ($command eq 'setremailercaps') {
diff --git a/Echolot/Scheduler.pm b/Echolot/Scheduler.pm
index df245c8..1331aff 100644
--- a/Echolot/Scheduler.pm
+++ b/Echolot/Scheduler.pm
@@ -1,7 +1,7 @@
package Echolot::Scheduler;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: Scheduler.pm,v 1.11 2002/07/22 01:28:21 weasel Exp $
+# $Id: Scheduler.pm,v 1.12 2002/08/23 07:54:53 weasel Exp $
#
=pod
@@ -62,19 +62,21 @@ sub add($$$$$) {
order => $ORDER++
};
- $self->schedule($name);
+ $self->schedule($name, 1);
return 1;
};
-=item B<schedule> (I<name>, I<for>)
+=item B<schedule> (I<name>, I<reschedule>, [ I<for>, [I<arguments>]] )
Schedule execution of I<name> for I<for>. If I<for> is not given it is calculated
-from I<interval> and I<offset> passed to B<new>.
+from I<interval> and I<offset> passed to B<new>. if I<reschedule> is set
+the task will be rescheduled when it's done (according to its interval).
+You may also give arguments to passed to the task.
=cut
-sub schedule($$;$$) {
- my ($self, $name, $for, $arguments) = @_;
+sub schedule($$$;$$) {
+ my ($self, $name, $reschedule, $for, $arguments) = @_;
(defined $self->{'tasks'}->{$name}) or
cluck("Task $name is not defined"),
@@ -99,7 +101,8 @@ sub schedule($$;$$) {
start => $for,
order => $self->{'tasks'}->{$name}->{'order'},
name => $name,
- arguments => $arguments
+ arguments => $arguments,
+ reschedule => $reschedule
};
@{ $self->{'schedule'} } = sort { $a->{'start'} <=> $b->{'start'} or $a->{'order'} <=> $b->{'order'} }
@@ -146,8 +149,8 @@ sub run($) {
print "Running $name at ".(time())." (scheduled for $now)\n" if Echolot::Config::get()->{'verbose'};
last if ($what eq 'exit');
&$what( $now, @{ $task->{'arguments'} } );
- $self->schedule($name, $now + $self->{'tasks'}->{$name}->{'interval'}) if
- ($self->{'tasks'}->{$name}->{'interval'} > 0);
+ $self->schedule($name, 1, $now + $self->{'tasks'}->{$name}->{'interval'}) if
+ ($task->{'reschedule'} && $self->{'tasks'}->{$name}->{'interval'} > 0);
(defined $self->{'schedule'}->[0]) or
cluck("Scheduler is empty"),
diff --git a/NEWS b/NEWS
index d6842a7..3b26c90 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+Changes in version 2.0beta33 - 2002-08-23
+ * Scheduler fixes (inserted jobs for one time processing got requeued
+ over and over again according to their interval).
+
Changes in version 2.0beta32 - 2002-08-23
* Fix a major bug introduced in 2.0beta31 that resulted in no
remailer-xxx queries beeing sent out.
diff --git a/debian/changelog b/debian/changelog
index 7d58d8b..0978463 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+echolot (000.2.0beta33-1) unstable; urgency=low
+
+ * New upstream version
+
+ -- Peter Palfrader <weasel@debian.org> Fri, 23 Aug 2002 09:54:10 +0200
+
echolot (000.2.0beta32-1) unstable; urgency=low
* New upstream version
diff --git a/pingd b/pingd
index ce65e4c..515e279 100755
--- a/pingd
+++ b/pingd
@@ -3,7 +3,7 @@
$| = 1;
# (c) 2002 Peter Palfrader <peter@palfrader.org>
-# $Id: pingd,v 1.69 2002/08/23 06:05:46 weasel Exp $
+# $Id: pingd,v 1.70 2002/08/23 07:54:53 weasel Exp $
#
=pod
@@ -287,7 +287,7 @@ use POSIX qw(setsid);
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
-my $VERSION = '2.0beta32';
+my $VERSION = '2.0beta33';
my $redirected_stdio = 0;
@@ -295,7 +295,7 @@ my $redirected_stdio = 0;
sub setSigHandlers() {
$SIG{'HUP'} = sub {
print "Got SIGHUP. scheduling readcommands\n";
- Echolot::Globals::get()->{'scheduler'}->schedule('readcommands', time() );
+ Echolot::Globals::get()->{'scheduler'}->schedule('readcommands', 0, time() );
if ($redirected_stdio) {
close STDOUT;
close STDERR;
@@ -305,15 +305,15 @@ sub setSigHandlers() {
};
$SIG{'INT'} = sub {
print "Got SIGINT. scheduling exit\n";
- Echolot::Globals::get()->{'scheduler'}->schedule('exit', time() );
+ Echolot::Globals::get()->{'scheduler'}->schedule('exit', 0, time() );
};
$SIG{'QUIT'} = sub {
print "Got SIGQUIT. scheduling exit\n";
- Echolot::Globals::get()->{'scheduler'}->schedule('exit', time() );
+ Echolot::Globals::get()->{'scheduler'}->schedule('exit', 0, time() );
};
$SIG{'TERM'} = sub {
print "Got SIGTERM. scheduling exit\n";
- Echolot::Globals::get()->{'scheduler'}->schedule('exit', time() );
+ Echolot::Globals::get()->{'scheduler'}->schedule('exit', 0, time() );
};
};
@@ -448,7 +448,7 @@ sub daemon_run($) {
$scheduler->add('getkeyconf' , Echolot::Config::get()->{'getkeyconf_interval'}, 0, \&Echolot::Conf::send_requests );
$scheduler->add('check_resurrection' , Echolot::Config::get()->{'check_resurrection'} , 0, \&Echolot::Conf::check_resurrection );
- Echolot::Globals::get()->{'scheduler'}->schedule('readcommands', time() )
+ Echolot::Globals::get()->{'scheduler'}->schedule('readcommands', 0, time() )
if ($process);
$scheduler->run();