Skip to content

Commit e2b4ca4

Browse files
authored
use goroutines during checks to fix the latency issue (#2506)
* use goroutines during checks to fix the latency issue * remove the skipping for orchestrator releaser * use depot for test builds
1 parent 9fb605b commit e2b4ca4

File tree

4 files changed

+58
-33
lines changed

4 files changed

+58
-33
lines changed

.github/workflows/backend_test.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,18 @@ jobs:
2222
uses: actions/checkout@v4
2323

2424
- name: Test that the docker image still builds successfully
25-
run: |
26-
export COMMIT_SHA=$(git rev-parse --short HEAD)
27-
docker build -t testingbuild:latest --build-arg COMMIT_SHA=${COMMIT_SHA} . -f Dockerfile_backend
25+
uses: depot/setup-action@v1
26+
27+
- name: Build Docker image with Depot
28+
uses: depot/build-push-action@v1
29+
with:
30+
project: f11hp4hlmg
31+
token: ${{ secrets.DEPOT_TOKEN }}
32+
context: .
33+
file: ./Dockerfile_backend
34+
push: false
35+
build-args: |
36+
COMMIT_SHA=${{ github.sha }}
2837
2938
- name: Deps
3039
run: go get -v ./...

.github/workflows/ee_backend_test.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,18 @@ jobs:
2222
uses: actions/checkout@v4
2323

2424
- name: Test that the docker image still builds successfully
25-
run: |
26-
export COMMIT_SHA=$(git rev-parse --short HEAD)
27-
docker build -t testingbuild:latest --build-arg COMMIT_SHA=${COMMIT_SHA} . -f Dockerfile_backend
25+
uses: depot/setup-action@v1
26+
27+
- name: Build Docker image with Depot
28+
uses: depot/build-push-action@v1
29+
with:
30+
project: kcld4zgwzx
31+
token: ${{ secrets.DEPOT_TOKEN }}
32+
context: .
33+
file: ./Dockerfile_backend_ee
34+
push: false
35+
build-args: |
36+
COMMIT_SHA=${{ github.sha }}
2837
2938
- name: Deps
3039
run: go get -v ./...

.github/workflows/update-helm-on-release.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ jobs:
3232
SERVICE="backend-ee"
3333
VERSION="${TAG_NAME##backend-ee/}"
3434
YAML_PATH=".taco-orchestrator.digger.image.tag"
35-
echo "Backend EE detected - skipping helm update (disabled for manual control)"
36-
exit 0
3735
elif [[ $TAG_NAME == drift/v* ]]; then
3836
SERVICE="drift"
3937
VERSION="${TAG_NAME##drift/}"

backend/controllers/projects.go

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,18 +1031,22 @@ func (d DiggerController) SetJobStatusForProject(c *gin.Context) {
10311031
"checkRunId", refreshedBatch.CheckRunId,
10321032
"vcs", refreshedBatch.VCS,
10331033
"jobId", jobId)
1034-
err = UpdateCheckRunForBatch(d.GithubClientProvider, refreshedBatch)
1035-
if err != nil {
1036-
slog.Warn("DIAGNOSTIC #7: Failed to update GitHub Check Run for batch (non-fatal)",
1037-
"batchId", batch.ID,
1038-
"checkRunId", refreshedBatch.CheckRunId,
1039-
"vcs", refreshedBatch.VCS,
1040-
"error", err,
1041-
"errorType", fmt.Sprintf("%T", err))
1042-
// Continue processing - Check Run update is best-effort, not critical
1043-
} else {
1044-
slog.Debug("Successfully updated GitHub Check Run for batch", "batchId", batch.ID)
1045-
}
1034+
1035+
// performing this in a goroutine to avoid huge latencies (added by ai summary gen)
1036+
go func() {
1037+
err = UpdateCheckRunForBatch(d.GithubClientProvider, refreshedBatch)
1038+
if err != nil {
1039+
slog.Warn("DIAGNOSTIC #7: Failed to update GitHub Check Run for batch (non-fatal)",
1040+
"batchId", batch.ID,
1041+
"checkRunId", refreshedBatch.CheckRunId,
1042+
"vcs", refreshedBatch.VCS,
1043+
"error", err,
1044+
"errorType", fmt.Sprintf("%T", err))
1045+
// Continue processing - Check Run update is best-effort, not critical
1046+
} else {
1047+
slog.Debug("Successfully updated GitHub Check Run for batch", "batchId", batch.ID)
1048+
}
1049+
}()
10461050

10471051
slog.Debug("Fetching refreshed job", "jobId", jobId, "batchId", batch.ID)
10481052
refreshedJob, err := models.DB.GetDiggerJob(jobId)
@@ -1060,19 +1064,24 @@ func (d DiggerController) SetJobStatusForProject(c *gin.Context) {
10601064
"checkRunId", refreshedJob.CheckRunId,
10611065
"vcs", refreshedJob.Batch.VCS,
10621066
"batchId", batch.ID)
1063-
err = UpdateCheckRunForJob(d.GithubClientProvider, refreshedJob)
1064-
if err != nil {
1065-
slog.Warn("DIAGNOSTIC #9: Failed to update GitHub Check Run for job (non-fatal)",
1066-
"jobId", jobId,
1067-
"checkRunId", refreshedJob.CheckRunId,
1068-
"batchId", batch.ID,
1069-
"vcs", refreshedJob.Batch.VCS,
1070-
"error", err,
1071-
"errorType", fmt.Sprintf("%T", err))
1072-
// Continue processing - Check Run update is best-effort, not critical
1073-
} else {
1074-
slog.Debug("Successfully updated GitHub Check Run for job", "jobId", jobId)
1075-
}
1067+
1068+
// performing this in a goroutine to avoid huge latencies (added by ai summary gen)
1069+
go func() {
1070+
err = UpdateCheckRunForJob(d.GithubClientProvider, refreshedJob)
1071+
if err != nil {
1072+
slog.Warn("DIAGNOSTIC #9: Failed to update GitHub Check Run for job (non-fatal)",
1073+
"jobId", jobId,
1074+
"checkRunId", refreshedJob.CheckRunId,
1075+
"batchId", batch.ID,
1076+
"vcs", refreshedJob.Batch.VCS,
1077+
"error", err,
1078+
"errorType", fmt.Sprintf("%T", err))
1079+
// Continue processing - Check Run update is best-effort, not critical
1080+
} else {
1081+
slog.Debug("Successfully updated GitHub Check Run for job", "jobId", jobId)
1082+
}
1083+
}()
1084+
10761085

10771086
if batch.ReportTerraformOutputs {
10781087
slog.Info("Generating Terraform outputs summary", "batchId", batch.ID)

0 commit comments

Comments
 (0)