Fix empty verification map on error#539
Open
erwin-willems wants to merge 6 commits intodeso-protocol:mainfrom
Open
Fix empty verification map on error#539erwin-willems wants to merge 6 commits intodeso-protocol:mainfrom
erwin-willems wants to merge 6 commits intodeso-protocol:mainfrom
Conversation
lazynina
requested changes
Mar 7, 2024
| verifiedMapStruct.VerifiedUsernameToPKID = make(map[string]*lib.PKID) | ||
|
|
||
| // Encode the map and stick it in the database. | ||
| metadataDataBuf := bytes.NewBuffer([]byte{}) |
routes/global_state.go
Outdated
| err := gs.GlobalStateDB.View(func(txn *badger.Txn) error { | ||
| item, err := txn.Get(key) | ||
| if err != nil { | ||
| // Todo: I think this error needs to be processed. It could be a key not found error, then nil should be returned. |
Member
There was a problem hiding this comment.
I think handling the error here means we do not need to delete the code below. Use errors.Is to compare err to badger's key not found error.
d752171 to
2118216
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A few times a month, our Verified Users data disappear. I think this is because of a retrieval error from badgerdb. This fix is to make sure the Verified Users are not overwritten with an empty map.
I think error handling on txn.Get needs to be reviewed