Skip to content

Conversation

@mdrohmann
Copy link
Contributor

@mdrohmann mdrohmann commented Jan 29, 2021

@mdrohmann
Copy link
Contributor Author

It is hard to tell, but I am fairly sure that if this fixed the problem. I could re-produce it once more without these changes (took a lot of tries), but now it does not seem to happen anymore...

@mdrohmann mdrohmann requested a review from daved January 30, 2021 00:02
daved
daved previously approved these changes Jan 30, 2021
if err != nil {
return errs.Wrap(err, "Could not load events on send")
}
if len(deferred) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: It might be worth, instead, using if len(deferred) > 0 and placing it around the cfg.Save below so that the "deferrerFilePath" is cleaned up.

@mdrohmann mdrohmann requested a review from Naatan February 1, 2021 17:34
for n, event := range deferred {
if err := sender(event.Category, event.Action, event.Label, event.Dimensions); err != nil {
return errs.Wrap(err, "Could not send deferred event")
if len(deferred) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: This is an unnecessary change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It skips the save of the configuration file, which I believe should be avoided if nothing changed. Of course, it doesn't affect this bug, but as we have seen that viper also has issues with concurrent writes between processes...

@mdrohmann mdrohmann merged commit 41cc299 into master Feb 1, 2021
@mdrohmann mdrohmann deleted the martind/viper-concurrency-176721598 branch February 1, 2021 18:08
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