Add more timings under $debug['time']['post'] in handle_post

- pre/post/during spamnoticer
This commit is contained in:
towards-a-new-leftypol 2024-12-31 02:42:31 +00:00
parent 300ff2de5e
commit f11c4cb1e7
1 changed files with 15 additions and 1 deletions

View File

@ -455,7 +455,10 @@ function validate_images(array $post_array) {
} }
function handle_post(){ function handle_post(){
global $config,$dropped_post,$board, $mod,$pdo; global $config, $dropped_post, $board, $mod, $pdo, $debug;
$time_1 = microtime(true);
$debug['time']['post'] = array();
init_global_post_cleanup(); init_global_post_cleanup();
@ -1029,6 +1032,9 @@ function handle_post(){
validate_images($post); validate_images($post);
$time_2 = microtime(true);
$debug['time']['post']['pre_noticer'] = round(($time_2 - $time_1) * 1000, 2) . 'ms';
if ($config['spam_noticer']['enabled']) { if ($config['spam_noticer']['enabled']) {
require_once 'inc/spamnoticer.php'; require_once 'inc/spamnoticer.php';
@ -1052,8 +1058,12 @@ function handle_post(){
if ($spam_noticer_result->succeeded && $spam_noticer_result->noticed) { if ($spam_noticer_result->succeeded && $spam_noticer_result->noticed) {
error($config['error']['spam_noticer'] . $spam_noticer_result->reason); error($config['error']['spam_noticer'] . $spam_noticer_result->reason);
} }
$debug['time']['post']['spam_noticer'] = round(($microtime(true) - $time_1) * 1000, 2) . 'ms';
} }
$time_3 = microtime(true);
if ($post['has_file']) { if ($post['has_file']) {
foreach ($post['files'] as $key => &$file) { foreach ($post['files'] as $key => &$file) {
if ($file['is_an_image']) { if ($file['is_an_image']) {
@ -1494,6 +1504,10 @@ function handle_post(){
$thread_id = $post['op'] ? $id : $post['thread']; $thread_id = $post['op'] ? $id : $post['thread'];
$time_end = microtime(true);
$debug['time']['post']['post_noticer'] = round(($time_end - $time_3) * 1000, 2) . 'ms';
$debug['time']['post']['total'] = round(($time_end - $time_1) * 1000, 2) . 'ms';
$rendered_thread = buildThread($thread_id); $rendered_thread = buildThread($thread_id);
if ($config['syslog']) if ($config['syslog'])