Skip to content

Commit 58e9348

Browse files
committed
add backoff on Service crd
1 parent e386a57 commit 58e9348

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

threescale_api_crd/resources.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
""" Module with resources for CRD for Threescale client """
22

3+
import backoff
34
import logging
45
import copy
56
import json
@@ -1979,7 +1980,12 @@ def __init__(self, entity_name="system_name", **kwargs):
19791980
for cey, walue in constants.KEYS_SERVICE.items():
19801981
if key == walue:
19811982
entity[cey] = value
1982-
entity["id"] = crd.as_dict().get("status").get(Services.ID_NAME)
1983+
1984+
@backoff.on_exception(backoff.fibo, AttributeError, max_tries=12, jitter=None)
1985+
def _get():
1986+
return crd.as_dict().get("status").get(Services.ID_NAME)
1987+
1988+
entity["id"] = _get()
19831989
# add ids to cache
19841990
if entity["id"] and entity[entity_name]:
19851991
Service.id_to_system_name[int(entity["id"])] = entity[entity_name]

0 commit comments

Comments
 (0)