Skip to content

Commit

Permalink
Do not fail to quickly if status is not available.
Browse files Browse the repository at this point in the history
  • Loading branch information
q-uint committed Mar 28, 2024
1 parent 668de8e commit 9d8e223
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package agent
import (
"encoding/binary"
"encoding/hex"
"errors"
"fmt"
"net/url"
"reflect"
Expand Down Expand Up @@ -279,6 +280,11 @@ func (a Agent) RequestStatus(ecID principal.Principal, requestID RequestID) ([]b
return nil, nil, err
}
status, err := hashtree.NewHashTree(node).Lookup(append(path, hashtree.Label("status"))...)
var lookupError hashtree.LookupError
if errors.As(err, &lookupError) && lookupError.Type == hashtree.LookupResultAbsent {
// The status might not be available immediately, since the request is still being processed.
return nil, nil, nil
}
if err != nil {
return nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion ic/ic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func TestModules(t *testing.T) {
if err != nil {
t.Skip(err)
}
start := exec.Command(dfxPath, "start", "--background", "--clean", "--artificial-delay=10")
start := exec.Command(dfxPath, "start", "--background", "--clean")
if err := start.Start(); err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 9d8e223

Please sign in to comment.