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

add restartable view support #105

Merged
merged 2 commits into from
Mar 14, 2018
Merged

add restartable view support #105

merged 2 commits into from
Mar 14, 2018

Conversation

db7
Copy link
Collaborator

@db7 db7 commented Mar 13, 2018

This PR resolves #102.

If one starts a view with the optiongoka.WithViewRestartable(), the view may be restarted or used, eg, by calling Get() and Recovered(), Iterator(), etc. To release all resources, ie, close the underlying local storage, one must call Stop() when using the Restartable() option.

@db7 db7 force-pushed the feature/restartable-views branch from d7293f2 to 8acf000 Compare March 13, 2018 15:05
SamiHiltunen
SamiHiltunen previously approved these changes Mar 13, 2018
sweigert
sweigert previously approved these changes Mar 13, 2018
@db7 db7 dismissed stale reviews from sweigert and SamiHiltunen via ba7e365 March 14, 2018 09:42
view.go Outdated
if v.terminated {
return fmt.Errorf("view: cannot reinitialize terminated view")
}
defer v.mInit.Unlock()
Copy link
Contributor

@SamiHiltunen SamiHiltunen Mar 14, 2018

Choose a reason for hiding this comment

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

This defer should be above the conditional as it could return without unlocking

@db7 db7 force-pushed the feature/restartable-views branch from ba7e365 to ecdeedf Compare March 14, 2018 09:51
@db7
Copy link
Collaborator Author

db7 commented Mar 14, 2018 via email

@db7 db7 merged commit e99e632 into master Mar 14, 2018
v.mInit.Lock()
if v.terminated {
return
v.mInit.Unlock()
Copy link

Choose a reason for hiding this comment

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

This unlock is dead code and could result in a deadlock.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

damn it. Thanks

@db7 db7 deleted the feature/restartable-views branch March 14, 2018 10:00
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.

View should have option to fallback to local-only mode
4 participants