Merge pull request #11346 from MrPetovan/bug/11343-memcached-bad-key

Suppress a couple MemcachedException
This commit is contained in:
Michael Vogel 2022-03-16 15:19:40 +01:00 committed by GitHub
commit f5bcc4ad4b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -27,6 +27,7 @@ use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Util\DateTimeFormat;
use Friendica\Util\Strings; use Friendica\Util\Strings;
use Friendica\Util\XML; use Friendica\Util\XML;
@ -121,10 +122,12 @@ function poco_init(App $a) {
if (isset($contact['account-type'])) { if (isset($contact['account-type'])) {
$contact['contact-type'] = $contact['account-type']; $contact['contact-type'] = $contact['account-type'];
} }
$about = DI::cache()->get("about:" . $contact['updated'] . ":" . $contact['nurl']);
$cacheKey = 'about:' . $contact['nick'] . ':' . DateTimeFormat::utc($contact['updated'], DateTimeFormat::ATOM);
$about = DI::cache()->get($cacheKey);
if (is_null($about)) { if (is_null($about)) {
$about = BBCode::convertForUriId($contact['uri-id'], $contact['about']); $about = BBCode::convertForUriId($contact['uri-id'], $contact['about']);
DI::cache()->set("about:" . $contact['updated'] . ":" . $contact['nurl'], $about); DI::cache()->set($cacheKey, $about);
} }
// Non connected persons can only see the keywords of a Diaspora account // Non connected persons can only see the keywords of a Diaspora account

View file

@ -168,7 +168,7 @@ class APContact
// Detect multiple fast repeating request to the same address // Detect multiple fast repeating request to the same address
// See https://github.com/friendica/friendica/issues/9303 // See https://github.com/friendica/friendica/issues/9303
$cachekey = 'apcontact:getByURL:' . $url; $cachekey = 'apcontact:' . ItemURI::getIdByURI($url);
$result = DI::cache()->get($cachekey); $result = DI::cache()->get($cachekey);
if (!is_null($result)) { if (!is_null($result)) {
Logger::notice('Multiple requests for the address', ['url' => $url, 'update' => $update, 'callstack' => System::callstack(20), 'result' => $result]); Logger::notice('Multiple requests for the address', ['url' => $url, 'update' => $update, 'callstack' => System::callstack(20), 'result' => $result]);