Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Fixes #1521: Snaptel hang on task watch #1537

Merged
merged 1 commit into from
Mar 1, 2017
Merged

Conversation

IRCody
Copy link
Contributor

@IRCody IRCody commented Feb 27, 2017

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

Copy link
Collaborator

@jcooklin jcooklin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -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)

Copy link
Contributor

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?

Copy link
Contributor Author

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.
@IRCody
Copy link
Contributor Author

IRCody commented Feb 28, 2017

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.

@candysmurf
Copy link
Contributor

LGTM 👍

Copy link
Contributor

@IzabellaRaulin IzabellaRaulin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@IRCody IRCody merged commit 17f0e1c into intelsdi-x:master Mar 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

snaptel task watch command in Snap version 1.1.0 hangs
5 participants