Add locks when creating short URL dependencies, to avoid race condition

This commit is contained in:
Alejandro Celaya
2023-05-21 18:08:17 +02:00
parent ac0ff8fb94
commit e85d59c5a4
3 changed files with 64 additions and 6 deletions

View File

@@ -13,6 +13,7 @@ use Shlinkio\Shlink\Core\ErrorHandler;
use Shlinkio\Shlink\Core\Options\NotFoundRedirectOptions;
use Shlinkio\Shlink\Importer\ImportedLinksProcessorInterface;
use Shlinkio\Shlink\IpGeolocation\Resolver\IpLocationResolverInterface;
use Symfony\Component\Lock;
return [
@@ -172,7 +173,11 @@ return [
],
Action\RobotsAction::class => [Crawling\CrawlingHelper::class],
ShortUrl\Resolver\PersistenceShortUrlRelationResolver::class => ['em', Options\UrlShortenerOptions::class],
ShortUrl\Resolver\PersistenceShortUrlRelationResolver::class => [
'em',
Options\UrlShortenerOptions::class,
Lock\LockFactory::class,
],
ShortUrl\Helper\ShortUrlStringifier::class => ['config.url_shortener.domain', 'config.router.base_path'],
ShortUrl\Helper\ShortUrlTitleResolutionHelper::class => [Util\UrlValidator::class],
ShortUrl\Helper\ShortUrlRedirectionBuilder::class => [Options\TrackingOptions::class],