Skip to content

Commit 43962bc

Browse files
committed
infer timeout
1 parent cfffbf1 commit 43962bc

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

pkg/workflows/wasm/host/module.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -547,15 +547,14 @@ func runWasm[I, O proto.Message](
547547
_, err = start.Call(store)
548548
executionDuration := time.Since(startTime)
549549

550-
// Is this an intentional controlled exit (such as the epoch deadline trap firing, not an error in the wasi runtime)
551-
var intentionalControlledExit bool
552-
switch v := err.(type) { // This error will never be wrapped
553-
case *wasmtime.Error:
554-
_, intentionalControlledExit = v.ExitStatus()
555-
default:
550+
// Is this an intentional controlled exit? (such as the epoch deadline trap firing, not an error in the wasi runtime)
551+
intentionalControlledExit := false
552+
var wtErr *wasmtime.Error
553+
if errors.As(err, &wtErr) {
554+
_, intentionalControlledExit = wtErr.ExitStatus()
556555
}
557556

558-
// If it's a controlled exit and the timeout has been reached or exceeded, we return a timeout error
557+
// If it's a controlled exit and the timeout has been reached or exceeded, return a timeout error
559558
// Note - there is no other reliable signal on the error that can be used to infer it is due to a timeout (epoch deadline
560559
// being reached) and if it is a controlled exit then the chances of it being anything other than a timeout are very
561560
// low if the timeout has been exceeded

0 commit comments

Comments
 (0)