Skip to content

Commit 743a0f3

Browse files
committed
Use timeout seconds as variable inside a function, for future refactoring
1 parent 9bc8f7c commit 743a0f3

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/vws/vws.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
from urllib.parse import urljoin
1111

1212
import requests
13-
import timeout_decorator
1413
from requests import Response
14+
from timeout_decorator import timeout
1515

1616
from vws._authorization import authorization_header, rfc_1123_date
1717
from vws.exceptions import (
@@ -306,7 +306,6 @@ def _wait_for_target_processed(
306306

307307
sleep(seconds_between_requests)
308308

309-
@timeout_decorator.timeout(seconds=60 * 5)
310309
def wait_for_target_processed(
311310
self,
312311
target_id: str,
@@ -334,10 +333,16 @@ def wait_for_target_processed(
334333
~vws.exceptions.UnknownTarget: The given target ID does not match a
335334
target in the database.
336335
"""
337-
self._wait_for_target_processed(
338-
target_id=target_id,
339-
seconds_between_requests=seconds_between_requests,
340-
)
336+
timeout_seconds = 60 * 5
337+
338+
@timeout(seconds=timeout_seconds)
339+
def decorated():
340+
self._wait_for_target_processed(
341+
target_id=target_id,
342+
seconds_between_requests=seconds_between_requests,
343+
)
344+
345+
decorated()
341346

342347
def list_targets(self) -> List[str]:
343348
"""

0 commit comments

Comments
 (0)