Skip to content

Commit c94639c

Browse files
author
Andrei Neagu
committed
fixed interfaces and errors
1 parent 417f92b commit c94639c

File tree

1 file changed

+7
-5
lines changed
  • packages/service-library/src/servicelib/long_running_interfaces

1 file changed

+7
-5
lines changed

packages/service-library/src/servicelib/long_running_interfaces/_client.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import asyncio
22
import logging
33
from datetime import timedelta
4-
from typing import Any, Final, TypeVar
4+
from typing import Annotated, Any, Final, TypeVar
55
from uuid import uuid4
66

7-
from pydantic import ConfigDict, NonNegativeInt, validate_call
7+
from pydantic import ConfigDict, Field, NonNegativeInt, validate_call
88
from settings_library.rabbit import RabbitSettings
99
from settings_library.redis import RedisSettings
1010

@@ -111,7 +111,7 @@ async def _track_job_if_not_tracked(
111111
params=params,
112112
remaining_attempts=retry_count,
113113
),
114-
timeout=timeout,
114+
expire=timeout,
115115
)
116116

117117
async def _decrease_remaining_attempts_or_raise(
@@ -147,7 +147,9 @@ async def _start_job_if_missing(
147147
await self._rpc_interface.start(
148148
name, unique_id, timeout=timeout, **params
149149
)
150-
await self._store_interface.update_timeout(unique_id, timeout=timeout)
150+
await self._store_interface.update_entry_expiry(
151+
unique_id, expire=timeout
152+
)
151153
except AlreadyStartedError:
152154
_logger.info(
153155
"unique_id='%s', was already running, did not start", unique_id
@@ -232,7 +234,7 @@ async def ensure_result( # type: ignore[valid-type]
232234
expected_type: type[ResultType],
233235
timeout: timedelta, # noqa: ASYNC109
234236
is_unique: bool = False,
235-
retry_count: NonNegativeInt = 3,
237+
retry_count: Annotated[NonNegativeInt, Field(gt=0)] = 3,
236238
**params: Any,
237239
) -> ResultType:
238240

0 commit comments

Comments
 (0)