Pārlūkot izejas kodu

Merge pull request #4000 from pixelfed/staging

Staging
daniel 2 gadi atpakaļ
vecāks
revīzija
73d2d6916d

+ 1 - 0
CHANGELOG.md

@@ -68,6 +68,7 @@
 - Fix CustomEmoji, properly handle shortcode updates and delete old copy in case the extension changes ([bc29073a](https://github.com/pixelfed/pixelfed/commit/bc29073a))
 - Update reply pipelines, restore reply_count logic ([0d780ffb](https://github.com/pixelfed/pixelfed/commit/0d780ffb))
 - Update StatusTagsPipeline, reject if `type` not set ([91085c45](https://github.com/pixelfed/pixelfed/commit/91085c45))
+- Update ReplyPipelines, use more efficent reply count calculation ([d4dfa95c](https://github.com/pixelfed/pixelfed/commit/d4dfa95c))
 -  ([](https://github.com/pixelfed/pixelfed/commit/))
 
 ## [v0.11.4 (2022-10-04)](https://github.com/pixelfed/pixelfed/compare/v0.11.3...v0.11.4)

+ 1 - 2
app/Jobs/CommentPipeline/CommentPipeline.php

@@ -60,8 +60,7 @@ class CommentPipeline implements ShouldQueue
         $actor = $comment->profile;
 
         if(config('database.default') === 'mysql') {
-            $count = DB::select( DB::raw("select id, in_reply_to_id from statuses, (select @pv := :kid) initialisation where id > @pv and find_in_set(in_reply_to_id, @pv) > 0 and @pv := concat(@pv, ',', id)"), [ 'kid' => $status->id]);
-            $status->reply_count = count($count);
+            $status->reply_count = $status->reply_count + 1;
             $status->save();
         }
 

+ 1 - 2
app/Jobs/StatusPipeline/StatusReplyPipeline.php

@@ -69,8 +69,7 @@ class StatusReplyPipeline implements ShouldQueue
         }
 
         if(config('database.default') === 'mysql') {
-            $count = DB::select( DB::raw("select id, in_reply_to_id from statuses, (select @pv := :kid) initialisation where id > @pv and find_in_set(in_reply_to_id, @pv) > 0 and @pv := concat(@pv, ',', id)"), [ 'kid' => $reply->id]);
-            $reply->reply_count = count($count);
+            $reply->reply_count = $reply->reply_count + 1;
             $reply->save();
         }