Skip to content

Commit 81ca041

Browse files
committed
Linting
1 parent 88abe0a commit 81ca041

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
from typing import TYPE_CHECKING
2+
3+
4+
if TYPE_CHECKING:
5+
from durabletask.task import OrchestrationContext
6+
7+
18
class EntityLock:
2-
def __init__(self, context):
9+
# Note: This should
10+
def __init__(self, context: 'OrchestrationContext'):
311
self._context = context
412

513
def __enter__(self):
614
return self
715

8-
def __exit__(self, exc_type, exc_val, exc_tb): # TODO: Handle exceptions?
16+
def __exit__(self, exc_type, exc_val, exc_tb):
917
self._context._exit_critical_section()

durabletask/task.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ def continue_as_new(self, new_input: Any, *, save_events: bool = False) -> None:
258258
"""
259259
pass
260260

261+
@abstractmethod
262+
def _exit_critical_section(self) -> None:
263+
pass
264+
261265

262266
class FailureDetails:
263267
def __init__(self, message: str, error_type: str, stack_trace: Optional[str]):

durabletask/worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ def lock_entities_function_helper(self, id: int, entities: list[EntityInstanceId
11691169
def _exit_critical_section(self) -> None:
11701170
if not self._entity_context.is_inside_critical_section:
11711171
# Possible if the user calls continue_as_new inside the lock - in the success case, we will call
1172-
# _exit_critical_section both from the EntityLock and the exit logic. We must keep both calls in
1172+
# _exit_critical_section both from the EntityLock and the continue_as_new logic. We must keep both calls in
11731173
# case the user code crashes after calling continue_as_new but before the EntityLock object is exited.
11741174
return
11751175
for entity_unlock_message in self._entity_context.emit_lock_release_messages():

0 commit comments

Comments
 (0)