summaryrefslogtreecommitdiffstats
path: root/web_src/js/features/repo-legacy.js
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2021-11-16 03:21:13 +0100
committerGitHub <noreply@github.com>2021-11-16 03:21:13 +0100
commit62926032155eef30bd380a27601fe770eb00e855 (patch)
tree82a177cfe4792d1732f14eb8073c79405c0fdb8f /web_src/js/features/repo-legacy.js
parent[skip ci] Updated translations via Crowdin (diff)
downloadforgejo-62926032155eef30bd380a27601fe770eb00e855.tar.xz
forgejo-62926032155eef30bd380a27601fe770eb00e855.zip
Fix database deadlock when update issue labels (#17649)
This fix updates issue labels one by one, and won't cause database deadlock. In future, we can use a batch API to update all changed labels by one request.
Diffstat (limited to '')
-rw-r--r--web_src/js/features/repo-legacy.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js
index 8945360cd5..74880c5dc7 100644
--- a/web_src/js/features/repo-legacy.js
+++ b/web_src/js/features/repo-legacy.js
@@ -84,18 +84,18 @@ export function initRepoCommentForm() {
$(`.${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(() => window.location.reload());
+ // TODO: Add batch functionality and make this 1 network request.
+ (async function() {
+ for (const [elementId, item] of Object.entries(items)) {
+ await updateIssuesMeta(
+ item['update-url'],
+ item.action,
+ item['issue-id'],
+ elementId,
+ );
+ }
+ window.location.reload();
+ })();
}
});