Remove panic() call from the unexpected relinquish execution
As this library is designed to be integrated into other software,
we should avoid using panic()
. Oterwise it may have really bad
outcomes.
For example, in GitLab Runner this library will be used to handle
autoscaling of jobs execution. If at any moment inst.acquired
would
go bellow 0 - even if such case is nearly impossible to happen - a
panic()
call would cause GitLab Runner process failure and
termination. This means that connection to all executed jobs would be
lost and they would be left in undefined state.
Unexpected or invalid situations should be either logged and handled gracefuly internally in the library or should be returned as an error to the caller.
Edited by Tomasz Maczukin