grid
grid copied to clipboard
Refactor Lease Expiry in Server
When a new grid server starts up, we end up waiting for the previous lease to expire. This requires something like :
select {
case <-time.After(leaseDuration):
case <-c.Done():
return
}
err = server.Serve(lis)
otherwise, we hit get an ErrAlreadyRegistered
here
https://github.com/lytics/grid/blob/b80e7e722aa8365601aeca828967eab0d63129a6/registry/registry.go#L406-L414
Instead, if we had something like server.WaitforLeaseToExpire()
, we could avoid the select
block.