From 421cf502bd3ba92bc32b63648c35f130b1798128 Mon Sep 17 00:00:00 2001 From: Subir Adhikari Date: Fri, 14 Oct 2022 13:21:10 +0530 Subject: [PATCH 1/5] fix for high cpu usage --- executor.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/executor.go b/executor.go index e9aafd57..9a9cd220 100644 --- a/executor.go +++ b/executor.go @@ -67,18 +67,17 @@ func (e *executor) start() { case RescheduleMode: return case WaitMode: - for { - select { - case <-stopCtx.Done(): - return - case <-f.ctx.Done(): - return - default: - } - - if e.maxRunningJobs.TryAcquire(1) { - break - } + select { + case <-stopCtx.Done(): + return + case <-f.ctx.Done(): + return + default: + } + + if err := e.maxRunningJobs.Acquire(f.ctx, 1); err != nil { + break + } } } From 1264b494f2df7340fddd9cc4714e4d08b9ca31c1 Mon Sep 17 00:00:00 2001 From: Subir Adhikari <41926114+mistu4u@users.noreply.github.com> Date: Fri, 14 Oct 2022 22:04:58 +0530 Subject: [PATCH 2/5] Update go_test.yml From 3db558d2102f3003366c182bd6d49b38db643a81 Mon Sep 17 00:00:00 2001 From: Subir Adhikari <41926114+mistu4u@users.noreply.github.com> Date: Fri, 14 Oct 2022 22:11:25 +0530 Subject: [PATCH 3/5] Update file_formatting.yml --- .github/workflows/file_formatting.yml | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/.github/workflows/file_formatting.yml b/.github/workflows/file_formatting.yml index 9b20d3dd..93bc17ce 100644 --- a/.github/workflows/file_formatting.yml +++ b/.github/workflows/file_formatting.yml @@ -6,14 +6,25 @@ on: branches: - main -name: formatting +name: golangci-lint jobs: - check-sorted: - name: check sorted + golangci: + strategy: + matrix: + go-version: + - 1.19 + name: lint and test runs-on: ubuntu-latest steps: - - name: checkout code + - name: Checkout code uses: actions/checkout@v3 - - name: verify example_test.go - run: | - grep "^func " example_test.go | sort -C + - name: golangci-lint + uses: golangci/golangci-lint-action@v3.2.0 + with: + version: v1.48.0 + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: ${{ matrix.go-version }} + - name: test + run: make test From 2040829e71b1cf36bece7b9c72505451163f68aa Mon Sep 17 00:00:00 2001 From: Subir Adhikari Date: Mon, 17 Oct 2022 10:56:40 +0530 Subject: [PATCH 4/5] revert file_formatting.yml to original --- .github/workflows/file_formatting.yml | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/.github/workflows/file_formatting.yml b/.github/workflows/file_formatting.yml index 93bc17ce..26332761 100644 --- a/.github/workflows/file_formatting.yml +++ b/.github/workflows/file_formatting.yml @@ -6,25 +6,14 @@ on: branches: - main -name: golangci-lint +name: formatting jobs: - golangci: - strategy: - matrix: - go-version: - - 1.19 - name: lint and test + check-sorted: + name: check sorted runs-on: ubuntu-latest steps: - - name: Checkout code + - name: checkout code uses: actions/checkout@v3 - - name: golangci-lint - uses: golangci/golangci-lint-action@v3.2.0 - with: - version: v1.48.0 - - name: Install Go - uses: actions/setup-go@v3 - with: - go-version: ${{ matrix.go-version }} - - name: test - run: make test + - name: verify example_test.go + run: | + grep "^func " example_test.go | sort -C \ No newline at end of file From 0939350421f94e0b8535f4179c0437bec43e7143 Mon Sep 17 00:00:00 2001 From: John Roesler Date: Mon, 17 Oct 2022 09:28:06 -0500 Subject: [PATCH 5/5] newline --- .github/workflows/file_formatting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/file_formatting.yml b/.github/workflows/file_formatting.yml index 26332761..9b20d3dd 100644 --- a/.github/workflows/file_formatting.yml +++ b/.github/workflows/file_formatting.yml @@ -16,4 +16,4 @@ jobs: uses: actions/checkout@v3 - name: verify example_test.go run: | - grep "^func " example_test.go | sort -C \ No newline at end of file + grep "^func " example_test.go | sort -C