bsdd: fix CI test failure by spacing API calls 3s apart

The retry logic alone is not sufficient: back-to-back calls can exhaust
the retry budget before the rate limit window resets. Sleep 3s between
each module-level prefetch call (the API limit is ~1 req/2s).

Generated with the assistance of an AI coding tool.
This commit is contained in:
Bruno Postle
2026-04-10 00:47:12 +01:00
parent 9bcc98aac3
commit 0e83b888a8
+9 -1
View File
@@ -1,19 +1,27 @@
import time
from bsdd import Client
client = Client()
# Fetch shared data at module level to avoid repeated API calls during tests.
# The Client.get() method handles 429 rate-limit responses with automatic retry.
# Sleep 3s between calls: the bSDD API rate-limits to ~1 req/2s, and Client.get()
# retries on 429, but back-to-back calls without spacing still exhaust the retry budget.
_dictionaries = client.get_dictionary()["dictionaries"]
ifc4x3_uri = next(l["uri"] for l in _dictionaries if "4.3" in l["uri"])
nbs_uri = next(l["uri"] for l in _dictionaries if "Uniclass 2015" == l["name"])
time.sleep(3)
_ifc4x3_classes = client.get_classes(ifc4x3_uri, use_nested_classes=False, class_type="Class")
time.sleep(3)
_nbs_classes = client.get_classes(nbs_uri, use_nested_classes=False, class_type="Class", offset=0, limit=5)
_uri_light_fixture = next(l for l in _ifc4x3_classes["classes"] if "IfcLightFixture" == l["code"])["uri"]
time.sleep(3)
_light_fixture = client.get_class(_uri_light_fixture)
time.sleep(3)
_light_fixture_relations = client.get_class_relations(_uri_light_fixture)
time.sleep(3)
_light_fixture_properties = client.get_class_properties(_uri_light_fixture)