Skip to content

Commit

Permalink
Return immediately from Job.wait() if a Job has a response
Browse files Browse the repository at this point in the history
  • Loading branch information
ohaibbq committed Apr 11, 2024
1 parent 5ad569f commit 2437402
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions internal/metadata/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ func (j *Job) Wait(ctx context.Context) (*internaltypes.QueryResponse, error) {
j.mu.Lock()
defer j.mu.Unlock()

if j.response != nil {
return j.response, nil
}

ticker := time.NewTicker(100 * time.Millisecond)
defer ticker.Stop()
for {
Expand Down

0 comments on commit 2437402

Please sign in to comment.