mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Removed unnecessary forUpdate from linkSubscription method
Closes https://linear.app/ghost/issue/ENG-1758/product-row-locking-in-linksubscription-causes-slowness-in-high-signup - The method used a FOR UPDATE query when fetching the Ghost product despite never updating that row. - In this case, we're only reading the default product to link it with a subscription - we're not actually modifying the default product itself. The operation is read-only in nature, therefore, the forUpdate lock is unnecessary - The actual update to the product happens later in the code when we call this._productRepository.update() with the stripe price data, and that operation has its own transaction handling and locking mechanisms
This commit is contained in:
parent
ea0e598bf2
commit
8bc723c641
1 changed files with 1 additions and 1 deletions
|
@ -944,7 +944,7 @@ module.exports = class MemberRepository {
|
|||
const subscriptionPriceData = _.get(subscription, 'items.data[0].price');
|
||||
let ghostProduct;
|
||||
try {
|
||||
ghostProduct = await this._productRepository.get({stripe_product_id: subscriptionPriceData.product}, {...options, forUpdate: true});
|
||||
ghostProduct = await this._productRepository.get({stripe_product_id: subscriptionPriceData.product}, options);
|
||||
// Use first Ghost product as default product in case of missing link
|
||||
if (!ghostProduct) {
|
||||
ghostProduct = await this._productRepository.getDefaultProduct({
|
||||
|
|
Loading…
Add table
Reference in a new issue