paulhoule / tentacruel

MIT License
0 stars 0 forks source link

suppress error message if can't fetch data because link is down #39

Closed paulhoule closed 5 years ago

paulhoule commented 5 years ago

the weather radar scripts in particular get data off the net and something fail with a name resolution error. I shouldn't get an email about that.

paulhoule commented 5 years ago

ok, this has been done for the fetch-metar script, which is here:

https://github.com/paulhoule/tentacruel/blob/master/tentacruel/metar/log_wx.py

and has an exception handler that looks like:

      try:
            metar = await get_metar(session, airport)
        except ClientConnectorError:
            (_, exception, _) = exc_info()
            inner_exception = exception.os_error
            if isinstance(inner_exception, gaierror) and "Temporary" in str(inner_exception):
                return
            raise

There are many things I hate about this but I am going to let it stand for now. I am not going to copy the fix over to the weather radar program just yet, however, because that one is a bit more complicated and I want to sleep on it.

I added a firewall rule on the egress router to cut tamamo (Linux) off from the net to simulate a network outage and it failed the same way that it does when the network glitches out.

If I simulate that condition while running it on my (Windows) laptop, I get a different error message, I think the process is going further because Windows is getting the DNS entry out of a cache.

I don't care much because I don't run it as a cron job in Windows, but there could be many cases (say DNS resolver in the house, DNS runs over WAN1, but the http request runs over WAN 2) where a different error message might happen too.

I want to get some experience and see what happens.