Ship production optimization M1-M12.5A: queues, metrics, HTTP observability, and vector search reliability.
Keep similar-ai from tripping the global circuit on a lone URL 502, clamp Qdrant search to 100, and add Server-Timing plus slow-request logging. Studio shared props, Academy S3 exists caching, heat chunking, and Redis/scheduler hygiene stay in this rollout.
This commit is contained in:
@@ -48,13 +48,32 @@ final class GenerateSitemapsCommand extends Command
|
||||
$this->newLine();
|
||||
|
||||
// ── Root sitemap index ────────────────────────────────────────────
|
||||
// Write several paths so nginx `location = /sitemap.xml` and child
|
||||
// listings stay in sync. `sitemaps/index.xml` is the canonical generated
|
||||
// index: it is a new filename, so a scheduler user can create it even
|
||||
// when a stale `sitemaps/sitemap.xml` is owned by another account.
|
||||
$t = microtime(true);
|
||||
$index = $build->buildIndex(force: true, persist: false, families: $families);
|
||||
$disk->put('sitemaps/sitemap.xml', $index['content']);
|
||||
$written++;
|
||||
$indexPaths = ['sitemaps/index.xml', 'sitemaps/sitemap.xml', 'sitemap.xml'];
|
||||
$indexWritten = 0;
|
||||
|
||||
foreach ($indexPaths as $path) {
|
||||
if ($this->writeXml($disk, $path, $index['content'])) {
|
||||
$written++;
|
||||
$indexWritten++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($indexWritten === 0) {
|
||||
$this->error('Failed to write any root sitemap index file. Check ownership of public/sitemap.xml and public/sitemaps/.');
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$this->line(sprintf(
|
||||
' <info>✔</info> sitemaps/sitemap.xml %d entries <comment>%.3fs</comment>',
|
||||
' <info>✔</info> sitemap index %d entries %d path(s) <comment>%.3fs</comment>',
|
||||
$index['url_count'],
|
||||
$indexWritten,
|
||||
microtime(true) - $t,
|
||||
));
|
||||
|
||||
@@ -78,7 +97,12 @@ final class GenerateSitemapsCommand extends Command
|
||||
}
|
||||
|
||||
$path = 'sitemaps/' . $documentName . '.xml';
|
||||
$disk->put($path, $built['content']);
|
||||
if (! $this->writeXml($disk, $path, $built['content'])) {
|
||||
$this->line(sprintf(' <fg=red>✖</> %s write failed', $documentName . '.xml'));
|
||||
$failed++;
|
||||
|
||||
continue;
|
||||
}
|
||||
$written++;
|
||||
|
||||
$this->line(sprintf(
|
||||
@@ -114,7 +138,12 @@ final class GenerateSitemapsCommand extends Command
|
||||
}
|
||||
|
||||
$path = 'sitemaps/' . $groupName . '.xml';
|
||||
$disk->put($path, $built['content']);
|
||||
if (! $this->writeXml($disk, $path, $built['content'])) {
|
||||
$this->line(sprintf(' <fg=red>✖</> %s.xml write failed', $groupName));
|
||||
$failed++;
|
||||
|
||||
continue;
|
||||
}
|
||||
$written++;
|
||||
|
||||
$this->line(sprintf(
|
||||
@@ -159,4 +188,17 @@ final class GenerateSitemapsCommand extends Command
|
||||
|
||||
return array_values(array_filter($enabled, fn (string $f): bool => in_array($f, $only, true)));
|
||||
}
|
||||
|
||||
private function writeXml(\Illuminate\Contracts\Filesystem\Filesystem $disk, string $path, string $content): bool
|
||||
{
|
||||
$ok = $disk->put($path, $content);
|
||||
|
||||
if ($ok !== true) {
|
||||
$this->warn(' Could not write '.$path);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user