Skip to content

Commit

Permalink
Add backoff
Browse files Browse the repository at this point in the history
  • Loading branch information
frafra committed Oct 1, 2024
1 parent 3569cd2 commit 47df1aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ dependencies = [
"flask>=2.2.2",
"hydra-core>=1.3.1",
"requests>=2.28.1",
"pydantic~=1.10.14"
"pydantic~=1.10.14",
"backoff"
]
description = ""
license = {text = "GPL-3.0+"}
Expand Down
4 changes: 4 additions & 0 deletions src/nvdb/vegobjekter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
from urllib.parse import urljoin

import backoff
import requests
import shapely.ops
import shapely.wkt
Expand Down Expand Up @@ -87,6 +88,9 @@ def get_start(self, **params):
).json()["metadata"]["neste"]["start"]

@cache.cached(timeout=60 * 60)
@backoff.on_exception(
backoff.expo, requests.exceptions.RequestException, max_time=60
)
def query(
self,
offset=0,
Expand Down

0 comments on commit 47df1aa

Please sign in to comment.