Skip to content

Commit

Permalink
Fix func backoff error (#133)
Browse files Browse the repository at this point in the history
* Write empty tile for any error during backoff

Rather than looking for TileError, assume any error emitted from the
backoff strategy should result in a blank tile. Typically, this will
actually be a BackoffError with an inner error of TileError.

* Upgrade unit test db version to 0.6.9
  • Loading branch information
mmcfarland authored Oct 27, 2022
1 parent cd4b560 commit 2f067f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pcfuncs/funclib/tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ async def _f() -> io.BytesIO:
is_throttle=lambda e: isinstance(e, TilerError),
strategy=BackoffStrategy(waits=[0.2, 0.5, 0.75, 1, 2]),
)
except TilerError as e:
logger.warning(f"Tile request: {e.resp.status} {url}")
except Exception:
logger.warning(f"Tile request failed with backoff: {url}")
img_bytes = Image.new("RGB", (self.tile_size, self.tile_size), "gray")
empty = io.BytesIO()
img_bytes.save(empty, format="png")
Expand Down
2 changes: 1 addition & 1 deletion pcstac/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"stac-fastapi.types @ git+https://github.com/stac-utils/stac-fastapi/@162a1a2c324b4c2bfe3451f7ae19d7840a0e0452#egg=stac-fastapi.types&subdirectory=stac_fastapi/types",
"pccommon",
# Required due to some imports related to pypgstac CLI usage in startup script
"pypgstac[psycopg]==0.6.6",
"pypgstac[psycopg]==0.6.9",
"pystac==1.*",
# TODO: remove after https://github.com/stac-utils/stac-fastapi/pull/466
"pygeoif==0.7",
Expand Down

0 comments on commit 2f067f1

Please sign in to comment.