Skip to content

Commit

Permalink
Wrap listener command processing in a transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorjerse committed Dec 5, 2023
1 parent 0fa6b57 commit d527117
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Added
- Add ``extend_lock`` method to redis cache in listener
- Add extending processing lock task to the listener

Changed
-------
- Wrap listener command processing in a transaction


===================
38.1.0 - 2023-11-21
Expand Down
3 changes: 2 additions & 1 deletion resolwe/flow/managers/listener/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@ def process_command(self, identity: PeerIdentity, message: Message) -> Response:

try:
logger.debug(__("Invoking handler {}.", handler_name))
response = handler(data_id, message, self)
with transaction.atomic():
response = handler(data_id, message, self)
# Check if data status was changed by the handler.
if self.get_data_fields(data_id, "status") == Data.STATUS_ERROR:
response.status = ResponseStatus.ERROR
Expand Down

0 comments on commit d527117

Please sign in to comment.