mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-23 04:19:27 +01:00
Create SQLite index for Messages table
This significantly speeds up certain SQL actions on the Messages table that were done for anti-flood detection. The bot should now be significantly more quicker to catch floods promptly without delay. (Also, comment out some logging messages. Perhaps revisit this and wrap them with a debug registry variable instead.)
This commit is contained in:
parent
19788eec47
commit
b23935b8dc
@ -117,6 +117,9 @@ CREATE TABLE IF NOT EXISTS Messages (
|
||||
)
|
||||
SQL
|
||||
|
||||
|
||||
$self->{dbh}->do('CREATE INDEX IF NOT EXISTS MsgIdx1 ON Messages(id, channel, mode)');
|
||||
|
||||
$self->{dbh}->begin_work();
|
||||
};
|
||||
$self->{pbot}->{logger}->log($@) if $@;
|
||||
@ -302,18 +305,22 @@ sub get_message_account {
|
||||
$sth->execute();
|
||||
my $rows = $sth->fetchall_arrayref({});
|
||||
|
||||
=cut
|
||||
foreach my $row (@$rows) {
|
||||
$self->{pbot}->{logger}->log("Found matching nick $row->{hostmask} with id $row->{id}\n");
|
||||
}
|
||||
=cut
|
||||
|
||||
if(not defined $rows->[0]) {
|
||||
$sth->bind_param(1, "%!$user\@$host");
|
||||
$sth->execute();
|
||||
$rows = $sth->fetchall_arrayref({});
|
||||
|
||||
=cut
|
||||
foreach my $row (@$rows) {
|
||||
$self->{pbot}->{logger}->log("Found matching user\@host mask $row->{hostmask} with id $row->{id}\n");
|
||||
}
|
||||
=cut
|
||||
}
|
||||
return $rows;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user