Points to note
Session can only be safely destroyed if there are no order creation requests in queue.
Tracking trades inside finex still does not help with deposits and transfers.
When order comes its locked amount is locked in session. After several requests session will be fully spent.
To detect incomes (trades, deposits, transfer) session be reopened.
Can destroy if: - No order creation requests in buffer.
Transafer made by peatio should indicate user's UID to destory his session.
Destroy can prevent trading for some time to ensure balance changes are applied before reopening.
Destroy and delete
Session destroy does not mean it is deleted in memory.
If session cannot be destroyed it will be moved to 'destroy' list, preventing reopening session. It will be deleted by session GC or by new user's requests later.