From 6cd1ccef3d18fd67e3418451c2eb6aa9f53bb63d Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 17 Nov 2021 13:32:31 +0800 Subject: [PATCH] Backport #17649, fix database deadlock when update issue labels (#17665) --- web_src/js/index.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/web_src/js/index.js b/web_src/js/index.js index 97653c0366..1b096a31de 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -408,18 +408,17 @@ function initCommentForm() { $(`.${selector}`).dropdown('setting', 'onHide', () => { hasUpdateAction = $listMenu.data('action') === 'update'; // Update the var if (hasUpdateAction) { - const promises = []; - Object.keys(items).forEach((elementId) => { - const item = items[elementId]; - const promise = updateIssuesMeta( - item['update-url'], - item.action, - item['issue-id'], - elementId, - ); - promises.push(promise); - }); - Promise.all(promises).then(reload); + (async function() { + for (const [elementId, item] of Object.entries(items)) { + await updateIssuesMeta( + item['update-url'], + item.action, + item['issue-id'], + elementId, + ); + } + window.location.reload(); + })(); } });