Skip to content

Commit

Permalink
Handling processing failure and timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
codemakerai-dev committed May 1, 2023
1 parent eafb934 commit 1949a6d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ func (c *Cli) process(cl client.Client, mode string, lang string, langVer string

if c.isCompleted(status) {
break
} else if c.isFailed(status) {
return nil, fmt.Errorf("the task processing has failed")
}

select {
Expand Down Expand Up @@ -510,6 +512,11 @@ func (c *Cli) isCompleted(status *client.GetProcessStatusResponse) bool {
return status.Status == client.StatusCompleted
}

func (c *Cli) isFailed(status *client.GetProcessStatusResponse) bool {
return status.Status == client.StatusFailed ||
status.Status == client.StatusTimedOut
}

func (c *Cli) backoff(retry int) {
retry -= nonExponentRetries
if retry < 0 {
Expand Down

0 comments on commit 1949a6d

Please sign in to comment.