From eb535a4b84fea89ed1e631df64d191ebf2d05acc Mon Sep 17 00:00:00 2001 From: Mike Cifelli <1836280-mike-cifelli@users.noreply.gitlab.com> Date: Sun, 25 Dec 2022 13:55:08 -0500 Subject: [PATCH] Switch to multiprocessing --- chutney.py | 6 +++--- chutney.service | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/chutney.py b/chutney.py index 0fdcdfe..2f7ae4d 100644 --- a/chutney.py +++ b/chutney.py @@ -1,8 +1,8 @@ import sys from character_display import CharacterDisplay -from threading import Event -from threading import Thread +from multiprocessing import Event +from multiprocessing import Process from signal import signal from signal import SIGTERM from time import sleep @@ -28,7 +28,7 @@ def main(): signal(SIGTERM, cleanExit(unicorn, haltEvent)) unicorn.brightness(0.3) - weatherThread = Thread(target=weatherLoop, args=[haltEvent]) + weatherThread = Process(target=weatherLoop, args=[haltEvent]) weatherThread.start() characterDisplay = CharacterDisplay(unicorn) diff --git a/chutney.service b/chutney.service index b854982..f041408 100644 --- a/chutney.service +++ b/chutney.service @@ -4,6 +4,7 @@ After=multi.user.target [Service] Type=simple +KillMode=mixed WorkingDirectory=$workingDirectory ExecStart=$execStart Restart=on-failure