Skip to content

Conversation

@erwin-willems
Copy link
Contributor

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

@erwin-willems erwin-willems requested a review from a team as a code owner February 8, 2024 09:41
verifiedMapStruct.VerifiedUsernameToPKID = make(map[string]*lib.PKID)

// Encode the map and stick it in the database.
metadataDataBuf := bytes.NewBuffer([]byte{})
Copy link
Member

Choose a reason for hiding this comment

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

Please revert these deletions.

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.
Copy link
Member

Choose a reason for hiding this comment

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

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.

@erwin-willems erwin-willems force-pushed the fix-verification-issues branch from d752171 to 2118216 Compare April 30, 2024 06:33
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.

2 participants