Skip to content

Commit

Permalink
Report timed out commands (#195)
Browse files Browse the repository at this point in the history
* Report timeouts in commands but not for each positioner

* Update changelog
  • Loading branch information
albireox committed Jan 9, 2023
1 parent 9855192 commit 05bb2d0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## Next version

### ✨ Improved

* [#195](https://github.com/sdss/jaeger/issues/195) Prevent late replies to timed out commands to flood the log/actor window. The errors are now redirected only to the CAN log. Timed out commands are reported unless the command is a broadcast with the number of replies not defined.


## 1.3.0 - January 2, 2023

### ✨ Improved
Expand Down
8 changes: 7 additions & 1 deletion python/jaeger/commands/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ async def process_reply(self, reply_message):
self._log(
f"received a reply from {pid} but the command has already timed out.",
level=logging.ERROR,
logs=[log, can_log],
logs=[can_log],
)
return
elif self.status == CommandStatus.CANCELLED:
Expand Down Expand Up @@ -536,6 +536,12 @@ def finish_command(self, status: CommandStatus, silent: bool = False):
elif self.status.failed:
level = logging.ERROR if not silent else logging.DEBUG
self._log(f"command finished with status {self.status.name!r}", level)
elif self.status.timed_out and self._n_replies is not None:
# Report the command timed out, but only if this is not a broadcast
# and the number expected replies is not known. In those cases the
# command will always time out and that's expected.
level = logging.ERROR if not silent else logging.DEBUG
self._log("command timed out.", level)

# For good measure we return all the UIDs
if self.is_broadcast:
Expand Down

0 comments on commit 05bb2d0

Please sign in to comment.