mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-29 07:19:23 +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:
parent
f2a45d74a6
commit
275ee6952f
@ -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;
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -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 {}
|
||||
|
Loading…
Reference in New Issue
Block a user