From d6be277a314cd741eb6d44f8297bee72a34d9463 Mon Sep 17 00:00:00 2001
From: "@mazikiou" <mazikiou@takima.fr>
Date: Mon, 13 Jun 2022 11:53:39 +0200
Subject: [PATCH] fix(recorder): reduced number of commits

---
 .../deadlock-extension/src/recorder/utils/gitea.ts  | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/deadlock-plugins/deadlock-extension/src/recorder/utils/gitea.ts b/deadlock-plugins/deadlock-extension/src/recorder/utils/gitea.ts
index bc332c1e..4f82b833 100644
--- a/deadlock-plugins/deadlock-extension/src/recorder/utils/gitea.ts
+++ b/deadlock-plugins/deadlock-extension/src/recorder/utils/gitea.ts
@@ -23,10 +23,15 @@ export enum CommitFrom {
 }
 
 export async function commitAndPushOnQueue(gitMission: GitMission, from: CommitFrom) {
-  gitQueue.push(async () => {
-    if (from === CommitFrom.Auto) await commitAndPushCode(gitMission);
-    if (from === CommitFrom.Run) await mergeMaster(gitMission);
-  });
+  if (from === CommitFrom.Run) {
+    gitQueue.push(async () => {
+      await mergeMaster(gitMission);
+    });
+  } else if (gitQueue.length() == 0) {
+    gitQueue.push(async () => {
+      await commitAndPushCode(gitMission);
+    });
+  }
 }
 
 async function commitAndPushCode(gitMission: GitMission) {
-- 
GitLab