Fix cleanup function placement

- registering cleanup should go after the potential error call
This commit is contained in:
towards-a-new-leftypol 2024-12-31 08:22:48 +00:00
parent e21a01dba6
commit 8ebe1aa560
2 changed files with 6 additions and 4 deletions

View File

@ -296,6 +296,8 @@ function checkWithSpamNoticer($config, $post, $boardname) {
print_err($body);
$reasons_bitmap = json_decode($body)->reason;
$result->reason = renderReasons($reasons_bitmap);
} else if ($config['debug']) {
print_err((string) $response->getBody());
}
} else {
print_err("spamnoticer status code: " . $status_code);

View File

@ -1044,6 +1044,10 @@ function handle_post(){
$spam_noticer_result = checkWithSpamNoticer($config, $post, $board['uri']);
if ($spam_noticer_result->succeeded && $spam_noticer_result->noticed) {
error($config['error']['spam_noticer'] . $spam_noticer_result->reason);
}
/*
* If we have an error with posting this later, send back the
* delete token to spamnoticer to remove the post from the recent
@ -1055,10 +1059,6 @@ function handle_post(){
push_global_post_cleanup($f_spamnoticer_cleanup_on_err);
if ($spam_noticer_result->succeeded && $spam_noticer_result->noticed) {
error($config['error']['spam_noticer'] . $spam_noticer_result->reason);
}
$debug['time']['post']['spam_noticer'] = round((microtime(true) - $time_1) * 1000, 2) . 'ms';
}