$sitemapRefreshStrategy =
$this->systemConfigService->
getInt('core.sitemap.sitemapRefreshStrategy'
);
if ($sitemapRefreshStrategy !== SitemapExporterInterface::STRATEGY_SCHEDULED_TASK
) { return;
} $this->
generate($message);
} private function generate(SitemapMessage
$message): void
{ if ($message->
getLastSalesChannelId() === null ||
$message->
getLastLanguageId() === null
) { return;
} $context =
$this->salesChannelContextFactory->
create('',
$message->
getLastSalesChannelId(),
[SalesChannelContextService::LANGUAGE_ID =>
$message->
getLastLanguageId()]);
try { $this->sitemapExporter->
generate($context, true,
$message->
getLastProvider(),
$message->
getNextOffset());
} catch (AlreadyLockedException
$exception) { $this->logger->
error(sprintf('ERROR: %s',
$exception->
getMessage()));
} }}