From f11c4cb1e760fa0af7e9f3a2b0123d246778f2b2 Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Tue, 31 Dec 2024 02:42:31 +0000 Subject: [PATCH] Add more timings under $debug['time']['post'] in handle_post - pre/post/during spamnoticer --- post.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/post.php b/post.php index 0f12ab4f..f331edc9 100644 --- a/post.php +++ b/post.php @@ -455,7 +455,10 @@ function validate_images(array $post_array) { } 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(); @@ -1029,6 +1032,9 @@ function handle_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']) { require_once 'inc/spamnoticer.php'; @@ -1052,8 +1058,12 @@ function handle_post(){ 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'; } + $time_3 = microtime(true); + if ($post['has_file']) { foreach ($post['files'] as $key => &$file) { if ($file['is_an_image']) { @@ -1494,6 +1504,10 @@ function handle_post(){ $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); if ($config['syslog'])