swarm icon indicating copy to clipboard operation
swarm copied to clipboard

Include a restart parameter

Open balena opened this issue 5 years ago • 2 comments

So Swarm.Tracker can figure out what is intended to happen on :DOWN message.

Basically the version 3.4.0 this change is based on ignores handoffs when the reason isn’t :noconnection (node down event); but this is bad when you do need a handoff during “graceful shutdowns”.

The restart parameter will assume the same values as those passed to Supervisor child spec: if :permanent then a handoff will occur always, if :transient only if the terminate reason is other than :normal | :shutdown | {:shutdown, term}, and if :temporary then it is never restarted, only when the node is down (that's the normal old behaviour which is assumed by default).

That's the same idea described on Supervisor / Restart values but applied to a cluster.

balena avatar May 05 '20 22:05 balena

Indicating that the process should have a lifetime that surpasses the natural logic of a regular GenServer means that we're probably willing to adopt a restart: :permanent policy, just like a Supervisor does https://github.com/bitwalker/swarm/issues/117

balena avatar May 05 '20 22:05 balena

This PR also solves https://github.com/bitwalker/swarm/issues/11 as the indicated solution of using Swarm.Tracker not always work (needs synchronization when terminating the app or there is no handoff at all).

balena avatar May 06 '20 13:05 balena