Skip to content

FluxMonitor: Expose DeviationChecker concurrency#2259

Closed
felder-cl wants to merge 1 commit into
developfrom
chore/flux-monitor-start-stop
Closed

FluxMonitor: Expose DeviationChecker concurrency#2259
felder-cl wants to merge 1 commit into
developfrom
chore/flux-monitor-start-stop

Conversation

@felder-cl

Copy link
Copy Markdown
Contributor

Give the user of the DeviationChecker control over concurrency by splitting its Start(..) method into one which connects and reports errors, and a second for polling the endpoint metrics.

This is in support avoiding race conditions in upcoming tests.

@samsondav

Copy link
Copy Markdown
Contributor

@felder-cl could you include a link to the story?

@felder-cl

Copy link
Copy Markdown
Contributor Author

@felder-cl could you include a link to the story?

Its not directly related to one. Its in support for upcoming changes for this one:
https://www.pivotaltracker.com/story/show/169366221

Comment thread core/services/flux_monitor.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why would we connect again if we are already connected?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure to be honest. This change preserves the same behavior though, so I assume its intended.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The method name connectSingleChecker and the error message we returned before were a bit misleading, as they were really just a wrapper around checker.Start, which also contained what is now checker.Connect. Just reads weird now, worth renaming to make what's going on more clear.

Comment thread core/services/flux_monitor.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this panic if err? Seems like execution might continue here, which might be undesirable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No this just logs an error, it does not panic

Comment thread core/services/flux_monitor_test.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this mocked? If so, is there any point in connecting here?

@felder-cl felder-cl Feb 6, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Its mocked out but instantiates fields within the struct. Start kind of assumes Connect was run.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll clarify this in the code

Give the user of the DeviationChecker control over concurrency by
splitting its Start(..) method into one which connects and reports
errors, and a second for polling the endpoint metrics.

This is in support avoiding race conditions in upcoming tests.
@felder-cl
felder-cl force-pushed the chore/flux-monitor-start-stop branch from 9cef642 to 4f30edd Compare February 6, 2020 15:53
@felder-cl

Copy link
Copy Markdown
Contributor Author

Closing in favor of making Stop() wait in #2233. This is still broken and might be nice to revisit later. The caller should generally be given control over concurrency, methods should not return with backgrounded processes.

@felder-cl felder-cl closed this Feb 7, 2020
@felder-cl
felder-cl deleted the chore/flux-monitor-start-stop branch February 7, 2020 12:11
@j16r

j16r commented Feb 8, 2020

Copy link
Copy Markdown
Contributor

@felder-cl doesn't Start() return a backgrounded process in your model?

@felder-cl

Copy link
Copy Markdown
Contributor Author

@felder-cl doesn't Start() return a backgrounded process in your model?

If 'Start()' returns with backgrounded processes, then it would have been by mistake. Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants