Skip to content

Commit

Permalink
Serve web in subprocess to avoid blocking.
Browse files Browse the repository at this point in the history
  • Loading branch information
anarkiwi committed Jul 10, 2023
1 parent 0b727ed commit 887c5ef
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions gamutrf/waterfall.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import datetime
import json
import logging
import multiprocessing
import os
import shutil
import signal
import tempfile
import threading
import time
import warnings
from pathlib import Path
Expand Down Expand Up @@ -886,14 +886,13 @@ def __init__(self, savefig_path, port, refresh=5):
self.app.add_url_rule(
"/" + self.savefig_file, self.savefig_file, self.serve_waterfall
)
self.thread = threading.Thread(
self.process = multiprocessing.Process(
target=self.app.run,
kwargs={"host": "0.0.0.0", "port": port}, # nosec
daemon=True,
)

def start(self):
self.thread.start()
self.process.start()

def serve(self):
return (
Expand Down

0 comments on commit 887c5ef

Please sign in to comment.