Skip to content

Commit 62c6c00

Browse files
committed
Updated dependency hashing.
Signed-off-by: Pavel Kirilin <win10@list.ru>
1 parent 926a386 commit 62c6c00

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

taskiq_dependencies/dependency.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import uuid
12
from typing import ( # noqa: WPS235
23
Any,
34
AsyncGenerator,
@@ -107,13 +108,14 @@ def __init__( # noqa: WPS234
107108
use_cache: bool = True,
108109
kwargs: Optional[Dict[str, Any]] = None,
109110
) -> None:
111+
self._id = uuid.uuid4()
110112
self.dependency = dependency
111113
self.use_cache = use_cache
112114
self.param_name = ""
113115
self.kwargs = kwargs or {}
114116

115117
def __hash__(self) -> int:
116-
return hash((self.dependency, self.use_cache, tuple(self.kwargs.keys())))
118+
return hash(self._id)
117119

118120
def __eq__(self, rhs: object) -> bool:
119121
"""
@@ -127,8 +129,4 @@ def __eq__(self, rhs: object) -> bool:
127129
"""
128130
if not isinstance(rhs, Dependency):
129131
return False
130-
return (self.dependency, self.use_cache, self.kwargs) == (
131-
rhs.dependency,
132-
rhs.use_cache,
133-
rhs.kwargs,
134-
)
132+
return self._id == rhs._id # noqa: WPS437

0 commit comments

Comments
 (0)