diff --git a/core/send_event.php b/core/send_event.php index c00e06f0..781e1c73 100644 --- a/core/send_event.php +++ b/core/send_event.php @@ -107,7 +107,7 @@ function shm_set_timeout(?int $timeout=null): void set_time_limit(is_null($timeout) ? 0 : $timeout); } -if(ini_get('max_execution_time')) { +if (ini_get('max_execution_time')) { shm_set_timeout((int)ini_get('max_execution_time') - 3); } @@ -139,8 +139,8 @@ function send_event(Event $event): Event ksort($my_event_listeners); foreach ($my_event_listeners as $listener) { - if($_shm_timeout && ftime() > $_shm_timeout) { - throw new TimeoutException(); + if ($_shm_timeout && ftime() > $_shm_timeout) { + throw new TimeoutException("Timeout while sending $event_name"); } if ($tracer_enabled) { $_tracer->begin(get_class($listener)); diff --git a/ext/tag_edit/main.php b/ext/tag_edit/main.php index b19e1dd0..2b6b1fc3 100644 --- a/ext/tag_edit/main.php +++ b/ext/tag_edit/main.php @@ -292,7 +292,7 @@ class TagEdit extends Extension private function mass_tag_edit(string $search, string $replace) { - global $database; + global $database, $tracer_enabled, $_tracer; $search_set = Tag::explode(strtolower($search), false); $replace_set = Tag::explode(strtolower($replace), false); @@ -317,6 +317,9 @@ class TagEdit extends Extension $last_id = -1; while (true) { + if ($tracer_enabled) { + $_tracer->begin("Batch starting with $last_id"); + } // make sure we don't look at the same images twice. // search returns high-ids first, so we want to look // at images with lower IDs than the previous. @@ -353,6 +356,9 @@ class TagEdit extends Extension $last_id = $image->id; } + if ($tracer_enabled) { + $_tracer->end(); + } } }