gajus / lightship

Abstracts readiness, liveness and startup checks and graceful shutdown of Node.js services running in Kubernetes.
Other
518 stars 32 forks source link

Killing a beacon twice ends up killing a different beacon #65

Open rjbma opened 1 year ago

rjbma commented 1 year ago

I've just ran into a situation in which, for some reason (can add the specific use case, if needed), I ended up calling beacon.die() on the same beacon.

I was expecting it to either be an error or a no-op, but instead what I noticed is that it killed the beacon in question, as well as some other totally unrelated beacon that was also active.

The culprit is most likely this line. I believe we should check if indexOf returns -1, instead of blindly splicing the array.