From 009d86e7a6de5a9a859c6f2fd87c0745e908f0de Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 26 Jun 2021 16:25:33 +0100 Subject: [PATCH] Sentry: only report METAR parse failures once per session. --- src/Environment/realwx_ctrl.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Environment/realwx_ctrl.cxx b/src/Environment/realwx_ctrl.cxx index cfcf72007..6cf7cc662 100644 --- a/src/Environment/realwx_ctrl.cxx +++ b/src/Environment/realwx_ctrl.cxx @@ -124,12 +124,18 @@ void LiveMetarProperties::handleMetarData( const std::string & data ) _timeToLive = DEFAULT_TIME_TO_LIVE_SECONDS; SGSharedPtr m; + static bool haveReportedMETARFailure = false; try { m = new FGMetar(data.c_str()); } catch( sg_io_exception &) { SG_LOG( SG_ENVIRONMENT, SG_WARN, "Can't parse metar: " << data ); - flightgear::sentryReportException("Failed to parse live METAR", data); + + // ensure we only report one METAR parse failure per session + if (!haveReportedMETARFailure) { + haveReportedMETARFailure = true; + flightgear::sentryReportException("Failed to parse live METAR", data); + } _failure = true; return; }