improved error handling
instead of having a component crashing, it will issue a warning with the error
This commit is contained in:
parent
e12073ede0
commit
9480339b89
5 changed files with 28 additions and 7 deletions
|
@ -4,7 +4,6 @@ from datetime import datetime, timedelta
|
||||||
import numpy
|
import numpy
|
||||||
import pause
|
import pause
|
||||||
import pydub
|
import pydub
|
||||||
from numpy.f2py.auxfuncs import l_and
|
|
||||||
from pydub.utils import make_chunks
|
from pydub.utils import make_chunks
|
||||||
|
|
||||||
from source.behaviors.roles import base
|
from source.behaviors.roles import base
|
||||||
|
@ -68,8 +67,6 @@ class MasterRole(base.BaseActiveRole):
|
||||||
if latency > self.latency:
|
if latency > self.latency:
|
||||||
self.latency = latency
|
self.latency = latency
|
||||||
|
|
||||||
print(self.latency)
|
|
||||||
|
|
||||||
# broadcast it in the network
|
# broadcast it in the network
|
||||||
audio_packet = AudioPacket(
|
audio_packet = AudioPacket(
|
||||||
# TODO(Faraphel): adjust time depending on the network average latency ?
|
# TODO(Faraphel): adjust time depending on the network average latency ?
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import threading
|
import threading
|
||||||
|
import traceback
|
||||||
import typing
|
import typing
|
||||||
|
import warnings
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
|
@ -96,4 +98,8 @@ class AudioManager:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
self.handle()
|
try:
|
||||||
|
self.handle()
|
||||||
|
|
||||||
|
except Exception: # NOQA
|
||||||
|
warnings.warn(traceback.format_exc())
|
|
@ -2,6 +2,8 @@ import hashlib
|
||||||
import json
|
import json
|
||||||
import random
|
import random
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import traceback
|
||||||
|
import warnings
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import pyudev
|
import pyudev
|
||||||
|
@ -73,4 +75,8 @@ class DriveManager:
|
||||||
|
|
||||||
def loop(self) -> None:
|
def loop(self) -> None:
|
||||||
while True:
|
while True:
|
||||||
self.handle()
|
try:
|
||||||
|
self.handle()
|
||||||
|
|
||||||
|
except Exception: # NOQA
|
||||||
|
warnings.warn(traceback.format_exc())
|
|
@ -1,4 +1,6 @@
|
||||||
import time
|
import time
|
||||||
|
import traceback
|
||||||
|
import warnings
|
||||||
|
|
||||||
from source import packets, structures
|
from source import packets, structures
|
||||||
from source.managers import Manager
|
from source.managers import Manager
|
||||||
|
@ -24,7 +26,11 @@ class PeerManager:
|
||||||
|
|
||||||
def loop(self) -> None:
|
def loop(self) -> None:
|
||||||
while True:
|
while True:
|
||||||
self.handle()
|
try:
|
||||||
|
self.handle()
|
||||||
|
|
||||||
|
except Exception: # NOQA
|
||||||
|
warnings.warn(traceback.format_exc())
|
||||||
|
|
||||||
# TODO(Faraphel): adjust sleep time ? as much seconds as there are peer to avoid flooding the network ?
|
# TODO(Faraphel): adjust sleep time ? as much seconds as there are peer to avoid flooding the network ?
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import traceback
|
||||||
|
import warnings
|
||||||
|
|
||||||
from source.behaviors import roles
|
from source.behaviors import roles
|
||||||
from source.managers import Manager
|
from source.managers import Manager
|
||||||
|
|
||||||
|
@ -26,4 +29,7 @@ class RoleManager:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
self.handle()
|
try:
|
||||||
|
self.handle()
|
||||||
|
except Exception: # NOQA
|
||||||
|
warnings.warn(traceback.format_exc())
|
Loading…
Reference in a new issue