mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 00:20:25 +08:00 
			
		
		
		
	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.
This commit is contained in:
		@@ -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();
 | 
			
		||||
        })();
 | 
			
		||||
      }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user