From d4e9c23f84d1744555dbfbfc2c28ccf37e054edb Mon Sep 17 00:00:00 2001 From: Simon Backx Date: Wed, 12 Apr 2023 12:47:31 +0200 Subject: [PATCH] Fixed select not happening inside transaction for bulk post actions no issue This potentially caused Knex timeout connection pool errors. --- ghost/posts-service/lib/PostsService.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ghost/posts-service/lib/PostsService.js b/ghost/posts-service/lib/PostsService.js index cbf780a1d3..cc8599cc91 100644 --- a/ghost/posts-service/lib/PostsService.js +++ b/ghost/posts-service/lib/PostsService.js @@ -104,7 +104,8 @@ class PostsService { const postRows = await this.models.Post.getFilteredCollectionQuery({ filter: options.filter, - status: 'all' + status: 'all', + transacting: options.transacting }).leftJoin('emails', 'posts.id', 'emails.post_id').select('posts.id', 'emails.id as email_id'); const deleteIds = postRows.map(row => row.id); @@ -177,7 +178,8 @@ class PostsService { const postRows = await this.models.Post.getFilteredCollectionQuery({ filter: options.filter, - status: 'all' + status: 'all', + transacting: options.transacting }).select('posts.id'); const editIds = postRows.map(row => row.id);