status-go
status-go copied to clipboard
Storing references into sync.Maps after loading and editing that reference
For a little context see the discussion here https://github.com/status-im/status-go/pull/2199#discussion_r613871484
I've introduced a lot of comments into the code base that read // TODO(samyoul) remove storing of an updated reference pointer?.
We've recently changed Messenger's use of maps to use custom sync.Maps and removed most usages of Messenger.mutex. While doing this I noticed that in a lot of cases we load a reference from a map and then perform some update on it and then save the reference back into the map.
In principle we are getting a reference from a map and updating the reference, then we give the reference back to the map, meaning we aren't updating the map's value and therefore don't need to store the reference back into the map.
We need to answer the question of what do we want to do?
- Do we want to store something after updating a reference pointer?
- If so why?
- Do we want to remove all storing of updated references?
- Are we happy without an explicit "update"?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.