Push the unit % modulo == 0 logic to modulo_distribution. In
distributed_wait check for leadership and return 0 if the leader
or call modulo_distribution with non_zero_wait=True.
When the distributed_wait function is called and the leader does not
happen to have 0 unit number, the leader winds up waiting while the
non-leader modulo 0 does not. Also when there are units > modulo
there may be conflicts with the leader when multiple units get modulo
0 and do not wait. Neither of these are desired behavior.
This change makes sure the leader, regardless of modulo, never waits.
And forces non-leaders which happen to get modulo 0 to wait.
For applications where the original behavior is desirable,
modulo_distribution can be used directly.
When the distributed_wait function is called and the leader does not
happen to have 0 unit number, the leader winds up waiting while the
non-leader modulo 0 does not. Also when there are units > modulo
there may be conflicts with the leader when multiple units get modulo
0 and do not wait. Neither of these are desired behavior.
This change makes sure the leader, regardless of modulo, never waits.
And forces non-leaders which happen to get modulo 0 to wait.
For applications where the original behavior is desirable,
modulo_distribution can be used directly.