Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Deprecation] Since symfony/lock 5.2: Symfony\Component\Lock\Store\RetryTillSaveStore is deprecated #383

Open
sverdier opened this issue Nov 20, 2021 · 3 comments

Comments

@sverdier
Copy link

Crunz version: 2.3.1

PHP version: 7.3

Operating system type and version: ubuntu 20.04

Description
[Deprecation] Since symfony/lock 5.2: Symfony\Component\Lock\Store\RetryTillSaveStore is deprecated

How to reproduce
use Symfony\Component\Lock\Store\RedisStore;
use Symfony\Component\Lock\Store\RetryTillSaveStore;

$redis = new Redis();
$redis->connect('localhost');
$persistingStore = new RedisStore($redis);
$blockingStore = new RetryTillSaveStore($persistingStore);

$task = $schedule->run(PHP_BINARY . ' email.php');
$task
->everyFiveMinutes()
->preventOverlapping($blockingStore);

Possible Solution

Additional context

@PabloKowalczyk
Copy link
Collaborator

As you can see deprecation is in your code, there is nothing wrong in Crunz.

@sverdier
Copy link
Author

sverdier commented Nov 22, 2021

@PabloKowalczyk This code it's your code on your readme =>

As of Symfony 5.0 the StoreInterface has been split into BlockingStoreInterface and PersistingStoreInterface. To use any of the persistent locks (Redis, PDO, etc) they need to be decorated by the RetryTillSaveStore.

<?php

use Symfony\Component\Lock\Store\RedisStore;
use Symfony\Component\Lock\Store\RetryTillSaveStore;

$redis = new Redis();
$redis->connect('localhost');
$persistingStore = new RedisStore($redis);
$blockingStore = new RetryTillSaveStore($persistingStore);

$task = $schedule->run(PHP_BINARY . ' email.php');
$task
    ->everyFiveMinutes()
    ->preventOverlapping($blockingStore);

@PabloKowalczyk
Copy link
Collaborator

You are right, would you like to provide a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants