Skip to content

Commit

Permalink
Merge pull request #14 from TariqAHassan/fix/call-post-op-before-upda…
Browse files Browse the repository at this point in the history
…ting-status

Fix: Call `.post_op()` before updating status
  • Loading branch information
TariqAHassan committed Jul 21, 2024
2 parents 530d6f4 + d04b004 commit a83e2d4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion alsek/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
from alsek.core.status import StatusTracker
from alsek.core.task import task

__version__: str = "0.3.0"
__version__: str = "0.3.1"
12 changes: 6 additions & 6 deletions alsek/core/futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,16 @@ def _wrapper(self) -> None:
exception = error
self.message.update(exception_details=parse_exception(exception).as_dict())

# Post op is called here so that exception_details can be set
self.task.post_op(self.message, result=result)

if self._wrapper_exit:
log.debug("Thread task future finished after termination.")
elif exception is not None:
_retry_future_handler(self.task, self.message, exception=exception)
else:
_complete_future_handler(self.task, self.message, result=result)

# Post op is called here so that exception_details can be set
self.task.post_op(self.message, result=result)

self._wrapper_exit = True

def stop(self, exception: Type[BaseException]) -> None:
Expand Down Expand Up @@ -268,16 +268,16 @@ def _wrapper(
exception = error
message.update(exception_details=parse_exception(exception).as_dict())

# Post op is called here so that exception_details can be set
task.post_op(message, result=result)

if not wrapper_exit_queue.empty():
log.debug("Process task future finished after termination.")
elif exception is not None:
_retry_future_handler(task, message=message, exception=exception)
else:
_complete_future_handler(task, message=message, result=result)

# Post op is called here so that exception_details can be set
task.post_op(message, result=result)

wrapper_exit_queue.put(1)

def _shutdown(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[metadata]
name = alsek
version = 0.3.0
version = 0.3.1
author = Tariq Hassan

0 comments on commit a83e2d4

Please sign in to comment.