Skip to content

Commit cb40f9b

Browse files
committed
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.
1 parent 04d202a commit cb40f9b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

coderd/provisionerdserver/provisionerdserver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ func (s *server) AcquireJob(ctx context.Context, _ *proto.Empty) (*proto.Acquire
321321
acqCtx, acqCancel := context.WithTimeout(ctx, s.acquireJobLongPollDur)
322322
defer acqCancel()
323323
job, err := s.Acquirer.AcquireJob(acqCtx, s.OrganizationID, s.ID, s.Provisioners, s.Tags)
324-
if xerrors.Is(err, context.DeadlineExceeded) {
324+
if database.IsQueryCanceledError(err) {
325325
s.Logger.Debug(ctx, "successful cancel")
326326
return &proto.AcquiredJob{}, nil
327327
}

0 commit comments

Comments
 (0)