Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Lock] Refine the contract and implementation for Stores to handle Not Expirable Store cases.#28727
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
61aca8c tod8e4de3Compared8e4de3 to5a0cad2Comparea5b504b to07457f3CompareGaneshChandrasekaran-zz commentedOct 4, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@jderusse - this is now ready for review. Also, I can't figure out why it's failing in this environment I have a feeling that it's reading files from |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
7d89ad2 toacea2b6CompareUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Lock/Tests/Store/ExpirableCombinedStoreTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
src/Symfony/Component/Lock/Tests/Store/RetryTillSaveStoreTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
2de1da7 to238958aCompare01b7fba to4ec842aCompareUh oh!
There was an error while loading.Please reload this page.
| publicfunctionputOffExpiration(Key$key,$ttl) | ||
| { | ||
| // do nothing, the flock locks forever. | ||
| thrownewNotExpirableStoreException(); |
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.
I wonder if it's should be treated like a BC break. ping@nicolas-grekas
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.
Looks like a BC break to me, but might be worth doing anyway instead of silently ignoring the call.
Uh oh!
There was an error while loading.Please reload this page.
ed9d45e toc110405Compare85e6204 to3efcaa2Compare…xpiration of locks.
fabpot left a comment
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.
Looks good to me with two small comments.@jderusse I think we need your approval before merging.
| publicfunctionputOffExpiration(Key$key,$ttl) | ||
| { | ||
| // do nothing, the flock locks forever. | ||
| thrownewNotExpirableStoreException(); |
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.
Looks like a BC break to me, but might be worth doing anyway instead of silently ignoring the call.
| } | ||
| returnnewCombinedStore(array(newRedisStore($redis)),newUnanimousStrategy()); | ||
| $zookeeper_server =getenv('ZOOKEEPER_HOST').':2181'; |
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.
Small typo, should be$zookeeperServer
| $this->logger->info('Expiration defined for "{resource}" lock for "{ttl}" seconds.',array('resource' =>$this->key,'ttl' =>$ttl)); | ||
| }catch (NotExpirableStoreException$e) { | ||
| $this->logger->notice('The store does not support expiration of locks.',array('store' =>$this->store)); |
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 methodrefresh is called internally when callingacquire with a non-null TTL (which is the default case when using the Factory with default arguments)
When using a NotExpirableStore (like flock) the logger will be full of notice.
Same comment when combining a non-expirable store and expirable one (flock + redis for instance)
IMHO You should either silent this exception when callingacquire or update the factory to set a null TTL when the store does not support expiration.
Would be great from a user point of view to known whether or not the store supports expiration.
interface StoreInterface { public function save(Key $key); public function waitAndSave(Key $key); public function delete(Key $key); public function exists(Key $key);}interface ExpirableStoreInterface extends StoreInterface { public function supportsExpiration(): bool public function putOffExpiration(Key $key, $ttl);}
Uh oh!
There was an error while loading.Please reload this page.
The Stores contract and implementation doesn't clearly distinguish between stores that support expirable stores and ones which don't. This change attempts to improve that for better usage of the functions by the services without running into runtime issues.