Ensure all Sidekiq queues are always alive
This commit is contained in:
parent
d81754f391
commit
bba787c06e
12
mastodon.nix
12
mastodon.nix
@ -36,6 +36,7 @@ let
|
|||||||
sidekiq-manager = pkgs.writers.writePython3 "sidekiq-manager" {} ''
|
sidekiq-manager = pkgs.writers.writePython3 "sidekiq-manager" {} ''
|
||||||
from itertools import permutations
|
from itertools import permutations
|
||||||
from subprocess import Popen
|
from subprocess import Popen
|
||||||
|
from time import sleep
|
||||||
|
|
||||||
|
|
||||||
def sidekiq(queues, connections=16):
|
def sidekiq(queues, connections=16):
|
||||||
@ -52,6 +53,17 @@ let
|
|||||||
queues = ['default', 'push', 'ingress']
|
queues = ['default', 'push', 'ingress']
|
||||||
procs += [sidekiq(qs) for qs in permutations(queues)]
|
procs += [sidekiq(qs) for qs in permutations(queues)]
|
||||||
|
|
||||||
|
for p in procs:
|
||||||
|
sleep(1)
|
||||||
|
if p.poll():
|
||||||
|
# one of the queues is dead
|
||||||
|
break
|
||||||
|
|
||||||
|
# terminate the rest queues
|
||||||
|
for p in procs:
|
||||||
|
# https://github.com/sidekiq/sidekiq/wiki/Signals#term
|
||||||
|
p.terminate()
|
||||||
|
|
||||||
for p in procs:
|
for p in procs:
|
||||||
p.wait()
|
p.wait()
|
||||||
'';
|
'';
|
||||||
|
Loading…
Reference in New Issue
Block a user