autodetach works correctly
- mutual exclusive lock with attaching executed by the apps
- contexts which are using stages are initially detached
The changes above fix problems with starting applications on api_haf_node: applications hold on waiting for a moment when HAF reaches LIVE state, and then immediately start processing together with hived starts running auto detach procedure. There is a race between 'auto detach' and apps -> apps need to update their active time faster than 'auto detach' will check it, some apps lost the race and were asynchronously detached in different stages of their algorithms which randomly ends with deadlocks or contexts resynchronization
API for creating contexts with stages was changed so apps need to be updated: The MRs below wait for it: hivemind!723 (merged) haf_block_explorer!213 (merged) reputation_tracker!25 (merged) balance_tracker!108 (merged)