mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-21 14:57:42 +00:00
Partial fix for mypy issues
This commit is contained in:
@@ -3,6 +3,7 @@ from __future__ import annotations
|
||||
import logging
|
||||
import threading
|
||||
import time
|
||||
from collections.abc import Sequence
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from core.config import config, create_provider_from_config
|
||||
@@ -48,7 +49,7 @@ class DataProviders:
|
||||
|
||||
@staticmethod
|
||||
def start_providers(
|
||||
providers: list[
|
||||
providers: Sequence[
|
||||
SpotProvider | AlertProvider | SolarConditionsProvider | StaticDataProvider | ActivityRefDataProvider | CallsignDataProvider
|
||||
],
|
||||
provider_type: str,
|
||||
@@ -108,13 +109,13 @@ class DataProviders:
|
||||
logger.exception("Exception stopping provider")
|
||||
|
||||
threads = [threading.Thread(target=stop_provider, args=(p,), daemon=True) for p in all_providers]
|
||||
for t in threads:
|
||||
t.start()
|
||||
for thread in threads:
|
||||
thread.start()
|
||||
|
||||
deadline = time.monotonic() + 15
|
||||
for t in threads:
|
||||
t.join(timeout=max(0.0, deadline - time.monotonic()))
|
||||
still_running = [t for t in threads if t.is_alive()]
|
||||
for thread in threads:
|
||||
thread.join(timeout=max(0.0, deadline - time.monotonic()))
|
||||
still_running = [thread for thread in threads if thread.is_alive()]
|
||||
if still_running:
|
||||
logger.warning("Some threads did not stop in time!")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user