Cleanup the ping action handler

master
Daniel Berteaud 11 years ago
parent 9c89212fbb
commit e00e0f7605
  1. 26
      public/vroom.pl

@ -529,27 +529,23 @@ post '/action' => sub {
);
}
elsif ($action eq 'ping'){
my $status = 'error';
my $msg = 'ERROR_OCCURED';
my $res = $self->ping_room($room);
# Cleanup expired rooms every ~10 pings
if ((int (rand 100)) <= 10){
$self->delete_rooms;
}
if (!$res){
return $self->render(
json => {
msg => $self->l('ERROR_OCCURED'),
status => 'error'
},
);
}
else{
return $self->render(
json => {
msg => '',
status => 'success'
}
);
if ($res){
$status = 'success';
$msg = '';
}
return $self->render(
json => {
msg => $msg,
status => $status
}
);
}
elsif ($action eq 'setPassword'){
my $pass = $self->param('password');

Loading…
Cancel
Save