protect against parser errors to prevent queue backlogging
This commit is contained in:
parent
68a1abd37e
commit
a0d219d120
@ -1,10 +1,17 @@
|
|||||||
from owrx.parser import Parser
|
from owrx.parser import Parser
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class PocsagParser(Parser):
|
class PocsagParser(Parser):
|
||||||
def parse(self, raw):
|
def parse(self, raw):
|
||||||
fields = raw.decode("ascii", "replace").rstrip("\n").split(";")
|
try:
|
||||||
meta = {v[0]: "".join(v[1:]) for v in map(lambda x: x.split(":"), fields) if v[0] != ""}
|
fields = raw.decode("ascii", "replace").rstrip("\n").split(";")
|
||||||
if "address" in meta:
|
meta = {v[0]: "".join(v[1:]) for v in map(lambda x: x.split(":"), fields) if v[0] != ""}
|
||||||
meta["address"] = int(meta["address"])
|
if "address" in meta:
|
||||||
self.handler.write_pocsag_data(meta)
|
meta["address"] = int(meta["address"])
|
||||||
|
self.handler.write_pocsag_data(meta)
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Exception while parsing Pocsag message")
|
||||||
|
@ -176,8 +176,8 @@ class WsjtParser(Parser):
|
|||||||
ReportingEngine.getSharedInstance().spot(out)
|
ReportingEngine.getSharedInstance().spot(out)
|
||||||
|
|
||||||
self.handler.write_wsjt_message(out)
|
self.handler.write_wsjt_message(out)
|
||||||
except (ValueError, IndexError):
|
except Exception:
|
||||||
logger.exception("error while parsing wsjt message")
|
logger.exception("Exception while parsing wsjt message")
|
||||||
|
|
||||||
def pushDecode(self, mode):
|
def pushDecode(self, mode):
|
||||||
metrics = Metrics.getSharedInstance()
|
metrics = Metrics.getSharedInstance()
|
||||||
|
Loading…
Reference in New Issue
Block a user