Configured timeout to clear Symfony cache #115
Conversation
*/ | ||
public function __construct(RouterInterface $router, Filesystem $filesystem, $cacheDir, $token, $phpCodeCacheEnabled, array $types, array $servers) | ||
public function __construct(RouterInterface $router, Filesystem $filesystem, $cacheDir, $token, $phpCodeCacheEnabled, array $types, array $servers, array $timeout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are more and more arguments here some of which are options, the constructor is getting big… maybe we should consider using the options resolver (in another PR)?
@OskarStark @greg0ire up to date according to your comments |
*/ | ||
public function __construct(RouterInterface $router, Filesystem $filesystem, $cacheDir, $token, $phpCodeCacheEnabled, array $types, array $servers) | ||
public function __construct(RouterInterface $router, Filesystem $filesystem, $cacheDir, $token, $phpCodeCacheEnabled, array $types, array $servers, array $timeouts) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a mandatory argument is a BC-break
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I added the default values in the configuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we're considering this class is internal and will never be used directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@soullivaneuh , can you comment on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The service would not be BC break but the class will be.
To have a perfect BC, we should make it optional with a warning like said on https://github.com/sonata-project/SonataCacheBundle/pull/115/files#r76977312.
d5497e5
to
e73d845
Compare
@OskarStark @greg0ire @soullivaneuh up to date according to your new comments ;) |
{ | ||
if (!$timeouts) { | ||
@trigger_error('The argument "timeouts" is missing, please inject it.', E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The "timeouts" argument is available since 3.x and will become mandatory in 4.0, please provide it"
->info(<<<'INFO' | ||
Timeout value specifying the amount of seconds that an output function | ||
blocks because flow control prevents data from being sent | ||
INFO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice heredoc usage.
LGTM, good job! |
Thank you @mremi 👍 |
\o/ :) When do you think tag a new version? |
@mremi and you got it: https://github.com/sonata-project/SonataCacheBundle/releases/tag/2.3.0 Thanks for your contributions. 👍 |
{ | ||
if (!$timeouts) { | ||
@trigger_error('The "timeouts" argument is available since 3.x and will become mandatory in 4.0, please provide it.', E_USER_DEPRECATED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should have been 2.x
and 3.0
I am targetting this branch, because this is BC.
Changelog
Subject
The timeout to clear the Symfony cache was hard-coded (2 seconds), I add some configuration to be able to tweak it as you want.