Skip to content

Commit

Permalink
Stream errors (#173)
Browse files Browse the repository at this point in the history
* catch stream error 3
  • Loading branch information
grantleehoffman authored Oct 22, 2021
1 parent fecd8a7 commit 93f875a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.8.5] - 2021-10-22
### Added
* Retry logging on stream INTERNAL_ERROR errors

## [0.8.4] - 2021-10-21
### Added
* Add `X-Accel-Buffering=no` header to service response calls for log streaming.

## [0.8.3] - 2021-10-05
Expand Down
5 changes: 3 additions & 2 deletions cli/internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ func (c *Client) GetLogs(ctx context.Context, workflowName string) (responses.Ge
func (c *Client) StreamLogs(ctx context.Context, w io.Writer, workflowName string) error {
var loggingCursorByte int64
// When we receive a stream error we continue and retry processing up to 5 times keeping track of the byte we were logging.
for i := 0; i < 5; i++ {
for i := 0; i < 10; i++ {
err := c.streamLogsToWriterAtCursor(ctx, w, workflowName, &loggingCursorByte)
if err != nil {
if strings.Contains(err.Error(), "stream error: stream ID 1; INTERNAL_ERROR") {
// if connection idle timeout occurs retry
if strings.Contains(err.Error(), "stream error: stream ID 1; INTERNAL_ERROR") || strings.Contains(err.Error(), "stream error: stream ID 3; INTERNAL_ERROR") {
time.Sleep(time.Second * 10)
continue
}
Expand Down

0 comments on commit 93f875a

Please sign in to comment.