3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-26 12:42:49 +01:00

Plugin/RemindMe: fix double-dequeue issue

Whoops. EventQueue already removes the event after processing it. There
is no point to dequeuing the reminder event from within do_reminder().
Doing this caused EventQueue to dequeue the event following the
reminder event.
This commit is contained in:
Pragmatic Software 2021-08-06 11:02:32 -07:00
parent f2a45d74a6
commit 275ee6952f
2 changed files with 9 additions and 7 deletions

View File

@ -351,7 +351,7 @@ sub do_reminder {
$event->{repeating} = 1;
} else {
# delete reminder from SQLite database
$self->delete_reminder($reminder->{id});
$self->delete_reminder($reminder->{id}, 1);
# tell PBot event queue not to reschedule this reminder
$event->{repeating} = 0;
@ -492,7 +492,7 @@ sub add_reminder {
# delete a reminder by its id, from SQLite and the PBot event queue
sub delete_reminder {
my ($self, $id) = @_;
my ($self, $id, $dont_dequeue) = @_;
return if not $self->{dbh};
@ -508,10 +508,12 @@ sub delete_reminder {
return 0;
}
# remove from event queue
my $removed = $self->{pbot}->{event_queue}->dequeue_event("reminder $id");
unless ($dont_dequeue) {
# remove from event queue
my $removed = $self->{pbot}->{event_queue}->dequeue_event("reminder $id");
$self->{pbot}->{logger}->log("RemindMe: dequeued events: $removed\n");
}
$self->{pbot}->{logger}->log("RemindMe: dequeued events: $removed\n");
return 1;
}

View File

@ -25,8 +25,8 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4343,
BUILD_DATE => "2021-08-04",
BUILD_REVISION => 4347,
BUILD_DATE => "2021-08-06",
};
sub initialize {}