-
-
Notifications
You must be signed in to change notification settings - Fork 824
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
(dev/core#174) Full PSR-16 compliance for SqlGroup #12379
Conversation
(Standard links)
|
Per comments on parent PR "SqlGroup is substantially rewritten. It no longer wraps around CRM_Core_BAO_Cache - instead, it does SQL queries which are similar in nature and uses its own front-cache." |
|
||
$lock = Civi::lockManager()->acquire("cache.{$this->group}_{$key}._null"); | ||
if (!$lock->isAcquired()) { | ||
throw new \CRM_Utils_Cache_CacheException("SqlGroup: Failed to acquire lock on cache key."); |
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.
Are these largely ignored? Failure to aquire a lock should not be a fatal error
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.
FWIW, this behavior is reproducing the behavior of CRM_Core_BAO_Cache::setItem()
. The only change (based on feedback from Seamus) was replacing CRM_Core_Error::fatal(...)
with throw new Exception(...)
.
IIRC, what you're referring to about the hard-failure for CiviMail is addressed within the locking subsystem (ie within CRM_Core_Lock
). That has some hacks which say, "If we're doing a CiviMail cronjob, then we won't try to acquire more locks, and we'll tell callers that our locks are working just fine." From the perspective of a specific lock user, they should still request/check locks as normal. The fudgery (as I understood it) was encapsulated within CRM_Core_Lock
.
This code should behave just as well (or badly) as the previous code from CRM_Core_BAO_Cache
.
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 only reason why i suggested Exception instead of fatal is that i believed that fatal calls were being removed in favor of exceptions.
This seems OK - I just want to check that the fail on failure to aquire lock is not a hard fail (given that we currently cannot grab a lock while civimail is running. ) |
sounds like its due to https://github.com/civicrm/civicrm-core/pull/12336/files, so somehow the status checks aren't actually getting hit into the cache |
@eileenmcnaughton @seamuslee001 - Yeah, that error (
There are a couple ways one might respond:
|
OK - let's monitor how much of a disruption this turns out to be & see. I'm happy to merge this now |
Overview
#12342 provides nominal compliance with PSR-16; however, some drivers raise exceptions or warnings for new options.
(This is a cherry-pick from #12360.)
Before
$cache->set(...$ttl)
would throw an error with any custom TTL.$cache->get(...$default)
would throw an error for any not-NULL default.$cache->set()
/$cache->get()
handle objects in ways that are unsafe.After
SqlGroup
has been fixed to comply (per SimpleCacheTest), and a unit-test ensures compliance.