This commit is contained in:
parent
2e9d72ed63
commit
3368f94c1a
|
@ -266,12 +266,11 @@ while (1) {
|
|||
Debug('Checking for timed actions');
|
||||
my $now = time();
|
||||
foreach my $action_time ( sort( grep { $_ < $now } @action_times ) ) {
|
||||
Info("Found actions expiring at $action_time");
|
||||
Info("Found " . scalar @{$actions{$action_time}} . "actions expiring at $action_time");
|
||||
foreach my $action ( @{$actions{$action_time}} ) {
|
||||
my $connection = $action->{connection};
|
||||
my $message = $action->{message};
|
||||
Info("Found action '$message'");
|
||||
handleMessage($connection, $message);
|
||||
Info("Found action '$$action{message}'");
|
||||
handleMessage($connection, $$action{message});
|
||||
}
|
||||
delete $actions{$action_time};
|
||||
}
|
||||
|
@ -443,6 +442,21 @@ sub handleDelay {
|
|||
my $action_text = shift;
|
||||
|
||||
my $action_time = time()+$delay;
|
||||
|
||||
# Need to check and cancel previous actions. See issue #2619
|
||||
foreach my $a_time ( keys %actions ) {
|
||||
if ( $a_time <= $action_time ) {
|
||||
for ( my $i = 0; $i < @{$actions{$a_time}}; $i ++ ) {
|
||||
my $action = $actions{$a_time}[$i];
|
||||
if ( $$action{message} eq $action_text ) {
|
||||
Info("Found duplicate action '$$action{message}' at $a_time, cancelling it");
|
||||
splice @{$actions{$a_time}}, $i, 1;
|
||||
}
|
||||
} # end foreach action
|
||||
delete $actions{$a_time} if !@{$actions{$a_time}};
|
||||
} # end if
|
||||
} # end foreach action_time
|
||||
|
||||
my $action_array = $actions{$action_time};
|
||||
if ( !$action_array ) {
|
||||
$action_array = $actions{$action_time} = [];
|
||||
|
|
Loading…
Reference in New Issue