Fix issue where, if a shutdown request was sent while parsing static reference data, the program would continue parsing. #118

This commit is contained in:
Ian Renton
2026-08-02 08:01:25 +01:00
parent 5bfe480f7c
commit 0b0c8aa4f3
22 changed files with 117 additions and 8 deletions
+12 -6
View File
@@ -15,10 +15,16 @@ class Toilets(LocalFileSIGRefDataProvider):
def _file_to_data(self, path):
new_data = []
f = open(path)
csv_data = f.read()
dr = csv.DictReader(csv_data.splitlines())
for row in dr:
new_data.append(SIGRef(sig=self.SIG, id=row["ref"], name=row["ref"], latitude=float(row["lat"]),
longitude=float(row["lon"])))
with open(path) as _f:
csv_data = _f.read()
dr = csv.DictReader(csv_data.splitlines())
for row in dr:
new_data.append(SIGRef(sig=self.SIG, id=row["ref"], name=row["ref"], latitude=float(row["lat"]),
longitude=float(row["lon"])))
# Bail out if a stop has been requested, i.e. the program is shutting down - no need to parse the rest
# of the data in this case
if self._stop:
break
return new_data