crunz icon indicating copy to clipboard operation
crunz copied to clipboard

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

Open sverdier opened this issue 3 years ago • 3 comments

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

sverdier avatar Nov 20 '21 10:11 sverdier

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

PabloKowalczyk avatar Nov 20 '21 16:11 PabloKowalczyk

@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);

sverdier avatar Nov 22 '21 20:11 sverdier

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

PabloKowalczyk avatar Nov 23 '21 07:11 PabloKowalczyk