Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Middleware fails to stop when monitor is absent #9

Merged
merged 2 commits into from
Sep 25, 2019

Conversation

kevburnsjr
Copy link
Owner

@kevburnsjr kevburnsjr commented Sep 24, 2019

Stumbled across this while testing something else.

Stop() hangs when no monitor is provided

Copy link

@koenbollen koenbollen left a comment

Choose a reason for hiding this comment

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

Nice catch! 👍

Quick question:
Is it not possible to attach a monitor after the cache is started? Would that then still work?

microcache_test.go Outdated Show resolved Hide resolved
@kevburnsjr
Copy link
Owner Author

kevburnsjr commented Sep 25, 2019

Unfortunately, the monitor dictates the polling interval so it's impossible to completely initialize in anticipation of a monitor when monitor is nil. You can add a monitor after instantiating the struct, you just need to call Start explicitly. Start is idempotent. I don't see a way around this without changing the interface.

@kevburnsjr kevburnsjr merged commit 4b1b091 into master Sep 25, 2019
@kevburnsjr kevburnsjr deleted the no-monitor-wont-stop branch September 25, 2019 16:46
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.

None yet

2 participants