Skip to content

Commit

Permalink
Some error handling on curl timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninjasoturi committed Mar 13, 2024
1 parent 3bb253f commit f4c7dce
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions core/bot/cleanup_run.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ function perform_cleanup(){
cleanup_log('Telegram cleanup starting. Found ' . $rs->rowCount() . ' entries for cleanup.');
if($rs->rowCount() > 0) {
while($row = $rs->fetch()) {
$cleanup_ids[] = $row['id'];
if($row['skip_del_message'] == 1) {
cleanup_log('Chat message for raid '.$row['raid_id'].' in chat '.$row['chat_id'].' is over 48 hours old. It can\'t be deleted by the bot. Skipping deletion and removing database entry.');
continue;
}
delete_message($row['chat_id'], $row['message_id']);
if(delete_message($row['chat_id'], $row['message_id']) === false) continue;
$cleanup_ids[] = $row['id'];
cleanup_log('Deleting raid: '.$row['raid_id'].' from chat '.$row['chat_id'].' (message_id: '.$row['message_id'].')');
if ($metrics){
$cleanup_total->inc(['telegram']);
Expand Down
4 changes: 3 additions & 1 deletion core/telegram/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,9 @@ function curl_json_request($post_contents, $identifier)
$json_response = curl_exec($curl);

if($json_response === false) {
info_log(curl_error($curl));
info_log(curl_error($curl));
curl_close($curl);
return false;
}

// Close connection.
Expand Down

0 comments on commit f4c7dce

Please sign in to comment.