From 61c41b8ec3b1ea1e120781c4fba5bbde880f466c Mon Sep 17 00:00:00 2001 From: Jamie Curnow Date: Tue, 12 Nov 2024 15:36:38 +1000 Subject: [PATCH] Fixes for hanging jobs, more verbose ci output --- backend/internal/jobqueue/main.go | 2 +- backend/internal/jobqueue/models.go | 3 +++ docker/dev/dnsrouter-config.json | 7 +++++-- docker/docker-compose.ci.yml | 1 + test/cypress/Dockerfile | 8 +++++--- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/backend/internal/jobqueue/main.go b/backend/internal/jobqueue/main.go index 9e52129f..5609823a 100644 --- a/backend/internal/jobqueue/main.go +++ b/backend/internal/jobqueue/main.go @@ -16,7 +16,7 @@ var ( func Start() { ctx, cancel = context.WithCancel(context.Background()) q := &Queue{ - jobs: make(chan Job), + jobs: make(chan Job, 10), ctx: ctx, cancel: cancel, } diff --git a/backend/internal/jobqueue/models.go b/backend/internal/jobqueue/models.go index a7ea2035..dc959cd6 100644 --- a/backend/internal/jobqueue/models.go +++ b/backend/internal/jobqueue/models.go @@ -10,6 +10,7 @@ type Queue struct { jobs chan Job ctx context.Context cancel context.CancelFunc + mu sync.Mutex } // Job - holds logic to perform some operations during queue execution. @@ -41,6 +42,8 @@ func (q *Queue) AddJobs(jobs []Job) { // AddJob sends job to the channel. func (q *Queue) AddJob(job Job) { + q.mu.Lock() + defer q.mu.Unlock() q.jobs <- job } diff --git a/docker/dev/dnsrouter-config.json b/docker/dev/dnsrouter-config.json index 9560d7b8..fbeab98e 100644 --- a/docker/dev/dnsrouter-config.json +++ b/docker/dev/dnsrouter-config.json @@ -24,5 +24,8 @@ "internal": null, "default_upstream": "127.0.0.11" } - ] -} \ No newline at end of file + ], + "cache": { + "disabled": true + } +} diff --git a/docker/docker-compose.ci.yml b/docker/docker-compose.ci.yml index e51453b6..4abae73f 100644 --- a/docker/docker-compose.ci.yml +++ b/docker/docker-compose.ci.yml @@ -75,6 +75,7 @@ services: image: jc21/dnsrouter volumes: - ./dev/dnsrouter-config.json.tmp:/dnsrouter-config.json:ro + entrypoint: /dnsrouter -v -c /dnsrouter-config.json cypress: image: "${IMAGE}-cypress:ci-${BUILD_NUMBER}" diff --git a/test/cypress/Dockerfile b/test/cypress/Dockerfile index 0c6f104f..b61784f1 100644 --- a/test/cypress/Dockerfile +++ b/test/cypress/Dockerfile @@ -2,9 +2,11 @@ FROM cypress/included:13.15.1 COPY --chown=1000 ./test /test -# Disable Cypress CLI colors -ENV FORCE_COLOR=0 -ENV NO_COLOR=1 +# Disable Cypress CLI colors by default +ARG FORCE_COLOR=0 +ARG NO_COLOR=1 +ENV FORCE_COLOR=$FORCE_COLOR \ + NO_COLOR=$NO_COLOR WORKDIR /test RUN yarn install && yarn cache clean