doLock example

$this->contextService = $contextService;
        $this->configWriter = $configWriter;
        $this->sitemapLock = $sitemapLock;
        $this->urlFilter = $urlFilter;
    }

    /** * {@inheritdoc} */
    public function generate(Shop $shop)
    {
        if (!$this->sitemapLock->doLock($shop$this->shopwareConfig->get('sitemapRefreshTime'))) {
            throw new AlreadyLockedException(sprintf('Cannot acquire lock for shop %d', $shop->getId()));
        }

        $routerContext = Context::createFromShop($shop$this->shopwareConfig);
        $shopContext = $this->contextService->createShopContext($shop->getId()$shop->getCurrency()->getId()$shop->getCustomerGroup()->getKey());

        foreach ($this->urlProvider as $urlProvider) {
            $urlProvider->reset();
            while ($urls = $urlProvider->getUrls($routerContext$shopContext)) {
                $urls = $this->urlFilter->filter($urls(int) $shop->getId());

                
Home | Imprint | This part of the site doesn't use cookies.