1
0
mirror of https://github.com/dani/vroom.git synced 2024-06-26 17:43:29 +02:00

Fix participant cleanup logic

This commit is contained in:
Daniel Berteaud 2014-07-20 12:53:57 +02:00
parent b8576f687b
commit 7d02133483

View File

@ -366,8 +366,9 @@ helper has_joined => sub {
helper delete_participants => sub {
my $self = shift;
$self->app->log->debug('Removing inactive participants from the database');
my $timeout = time()-600;
my $sth = eval {
$self->db->prepare("DELETE FROM `participants` WHERE (`activity_timestamp` < 600 OR `activity_timestamp` IS NULL);")
$self->db->prepare("DELETE FROM `participants` WHERE (`activity_timestamp` < $timeout OR `activity_timestamp` IS NULL);")
} || return undef;
$sth->execute() || return undef;
return 1;