From 10e7c71b6e7c2132139e5bb9ea2029ee63f3fa96 Mon Sep 17 00:00:00 2001 From: Diogo Peralta Cordeiro Date: Fri, 24 Dec 2021 00:38:42 +0000 Subject: [PATCH] [COMPONENT][Tag] Do not perform DB::flush in an event --- components/Tag/Tag.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/components/Tag/Tag.php b/components/Tag/Tag.php index 21e1c16230..dcd4e988c0 100644 --- a/components/Tag/Tag.php +++ b/components/Tag/Tag.php @@ -73,8 +73,7 @@ class Tag extends Component */ public function onProcessNoteContent(Note $note, string $content, string $content_type, array $extra_args): bool { - $matched_tags = []; - $processed_tags = false; + $matched_tags = []; preg_match_all(self::TAG_REGEX, $content, $matched_tags, \PREG_SET_ORDER); $matched_tags = array_unique(F\map($matched_tags, fn ($m) => $m[2])); foreach ($matched_tags as $match) { @@ -87,14 +86,10 @@ class Tag extends Component 'use_canonical' => $extra_args['tag_use_canonical'] ?? false, ])); Cache::pushList("tag-{$canonical_tag}", $note); - $processed_tags = true; foreach (self::cacheKeys($canonical_tag) as $key) { Cache::delete($key); } } - if ($processed_tags) { - DB::flush(); - } return Event::next; }