0x-mesh
0x-mesh copied to clipboard
[zeroex/orderwatch] Encapsulate OrderWatcher reference counting
There is lot's of duplicate code in the addAssetDataToOrderWatcher
and removeAssetDataFromOrderWatcher
functions in zeroex/orderwatch/order_watcher.go
. This duplicate code handles incrementing and decrementing reference counts on the asset data that is being watched by the orderwatcher. This is a bad piece of technical debt as it is very prone to bugs being introduced by changes and especially by the addition of new order types. At a minimum, this logic should be encapsulated in helper function.
It's also worth noting that this reference counting logic is not goroutine-safe, which may or may not be acceptable.