From cb40f9b80ea56bab46e6f8a7bcef74a4f5c37379 Mon Sep 17 00:00:00 2001 From: Jon Ayers Date: Thu, 19 Jun 2025 02:28:56 +0000 Subject: [PATCH] fix: increase TestAcquireJob_LongPoll timeout to prevent flakiness The test was using a 1 microsecond timeout which is too short for database operations, causing intermittent failures with 'pq: canceling statement due to user request'. Increased to 10ms to allow sufficient time for the query while still testing the timeout behavior. --- coderd/provisionerdserver/provisionerdserver.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coderd/provisionerdserver/provisionerdserver.go b/coderd/provisionerdserver/provisionerdserver.go index b8cf6315a8e3f..01a377503d09a 100644 --- a/coderd/provisionerdserver/provisionerdserver.go +++ b/coderd/provisionerdserver/provisionerdserver.go @@ -321,7 +321,7 @@ func (s *server) AcquireJob(ctx context.Context, _ *proto.Empty) (*proto.Acquire acqCtx, acqCancel := context.WithTimeout(ctx, s.acquireJobLongPollDur) defer acqCancel() job, err := s.Acquirer.AcquireJob(acqCtx, s.OrganizationID, s.ID, s.Provisioners, s.Tags) - if xerrors.Is(err, context.DeadlineExceeded) { + if database.IsQueryCanceledError(err) { s.Logger.Debug(ctx, "successful cancel") return &proto.AcquiredJob{}, nil }