extra tracing for bulk tag edit
This commit is contained in:
parent
c5e2353447
commit
e66acefa53
2 changed files with 10 additions and 4 deletions
|
@ -107,7 +107,7 @@ function shm_set_timeout(?int $timeout=null): void
|
||||||
set_time_limit(is_null($timeout) ? 0 : $timeout);
|
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);
|
shm_set_timeout((int)ini_get('max_execution_time') - 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,8 +139,8 @@ function send_event(Event $event): Event
|
||||||
ksort($my_event_listeners);
|
ksort($my_event_listeners);
|
||||||
|
|
||||||
foreach ($my_event_listeners as $listener) {
|
foreach ($my_event_listeners as $listener) {
|
||||||
if($_shm_timeout && ftime() > $_shm_timeout) {
|
if ($_shm_timeout && ftime() > $_shm_timeout) {
|
||||||
throw new TimeoutException();
|
throw new TimeoutException("Timeout while sending $event_name");
|
||||||
}
|
}
|
||||||
if ($tracer_enabled) {
|
if ($tracer_enabled) {
|
||||||
$_tracer->begin(get_class($listener));
|
$_tracer->begin(get_class($listener));
|
||||||
|
|
|
@ -292,7 +292,7 @@ class TagEdit extends Extension
|
||||||
|
|
||||||
private function mass_tag_edit(string $search, string $replace)
|
private function mass_tag_edit(string $search, string $replace)
|
||||||
{
|
{
|
||||||
global $database;
|
global $database, $tracer_enabled, $_tracer;
|
||||||
|
|
||||||
$search_set = Tag::explode(strtolower($search), false);
|
$search_set = Tag::explode(strtolower($search), false);
|
||||||
$replace_set = Tag::explode(strtolower($replace), false);
|
$replace_set = Tag::explode(strtolower($replace), false);
|
||||||
|
@ -317,6 +317,9 @@ class TagEdit extends Extension
|
||||||
|
|
||||||
$last_id = -1;
|
$last_id = -1;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
if ($tracer_enabled) {
|
||||||
|
$_tracer->begin("Batch starting with $last_id");
|
||||||
|
}
|
||||||
// make sure we don't look at the same images twice.
|
// make sure we don't look at the same images twice.
|
||||||
// search returns high-ids first, so we want to look
|
// search returns high-ids first, so we want to look
|
||||||
// at images with lower IDs than the previous.
|
// at images with lower IDs than the previous.
|
||||||
|
@ -353,6 +356,9 @@ class TagEdit extends Extension
|
||||||
|
|
||||||
$last_id = $image->id;
|
$last_id = $image->id;
|
||||||
}
|
}
|
||||||
|
if ($tracer_enabled) {
|
||||||
|
$_tracer->end();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue