Skip to content

Commit

Permalink
Don't crash on bad connection.
Browse files Browse the repository at this point in the history
  • Loading branch information
mossblaser committed Sep 29, 2018
1 parent 13813ef commit cca2592
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion qth_national_rail/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import datetime
import traceback
from argparse import ArgumentParser
from functools import partial

Expand Down Expand Up @@ -48,8 +49,11 @@ async def update_trains():
]),
client.set_property(qth_path + "/detailed", trains),
], loop=loop)
finally:
loop.call_later(interval, partial(loop.create_task, update_trains()))
except (IOError, OSError):
traceback.print_exc()
loop.call_later(30, partial(loop.create_task, update_trains()))

async def async_main():
await asyncio.wait([
Expand Down
2 changes: 1 addition & 1 deletion qth_national_rail/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.0"
__version__ = "0.1.1"

0 comments on commit cca2592

Please sign in to comment.