-
Notifications
You must be signed in to change notification settings - Fork 294
Fixes #1521: Snaptel hang on task watch #1537
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
mgmt/rest/client/task.go
Outdated
@@ -93,6 +93,9 @@ func (c *Client) CreateTask(s *Schedule, wf *wmap.WorkflowMap, name string, dead | |||
// interactive with Event and Done channels. An HTTP GET request retrieves tasks. | |||
// StreamedTaskEvent returns if it succeeds. Otherwise, an error is returned. | |||
func (c *Client) WatchTask(id string) *WatchTasksResult { | |||
// during watch we don't want to have a timeout | |||
c.http.Timeout = time.Duration(0) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling task watcher causes overwrite client timeout to 0 for ever. Maybe the timeout should be set to its real value (set by user) after finish task watch - what do you think about that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a good point. In the context of this fix I was thinking of the only user as snaptel which wouldn't be affected by this.
Removes the timeout from the rest client when using task watch. Because the timeout isn't reset on each transfer of data having a timeout causes the watch to eventually hang when set.
I updated to address @IzabellaRaulin comment if @jcooklin or anyone wants to look at this again really click. Only 2 additional lines to save the old timeout and then change it back to the old timeout when we are done watching. |
LGTM 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #1521
Summary of changes:
Removes the timeout from the rest client when using task watch. Because
the timeout isn't reset on each transfer of data having a timeout
causes the watch to eventually hang when set.
Testing done:
Would be interested in @mkleina verifying the fix works for them also.
@intelsdi-x/snap-maintainers