Skip to content

Commit

Permalink
don't throw exception if multi outline setup fails
Browse files Browse the repository at this point in the history
This could be a side effect of one of the micro feeders not having created an
outline, yet, or of folders being moved around or some other temporal issue.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
  • Loading branch information
dirkhh committed May 2, 2024
1 parent 5b07670 commit 62a4cb5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@


n = make_int(sys.argv[1] if len(sys.argv) > 1 else 1)
mo_data = MultiOutline().create(n)
try:
mo_data = MultiOutline().create(n)
except:
print_err("failed to MultiOutline class - maybe just a timing issue?")
exit(1)

# now we need to inject this into the stage2 tar1090
with TemporaryDirectory(prefix="/tmp/adsb") as tmpdir:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,23 @@ def _get_outlines(self, num):

def create(self, num):
data = self._get_outlines(num)
num = len(data)
result = {"multiRange": []}
polygons = []
for i in range(len(data)):
polygons.append(
Polygon(shell=LinearRing(data[i]["actualRange"]["last24h"]["points"]))
)
try:
polygons.append(
Polygon(
shell=LinearRing(data[i]["actualRange"]["last24h"]["points"])
)
)
except:
num -= 1
print(
f"can't create linear ring from outline #{i} - maybe there is no data, yet?"
)
made_change = True
look_at = range(1, len(data))
look_at = range(1, num)
while made_change:
made_change = False
to_consider = [0]
Expand Down

0 comments on commit 62a4cb5

Please sign in to comment.