mdbergmann / cl-gserver

Sento - Actor framework featuring actors and agents for easy access to state and asynchronous operations.

Home Page:https://mdbergmann.github.io/cl-gserver/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Discard message queue items that have timed out

mdbergmann opened this issue · comments

Sending messages to an actor with timeout will be processed even if the caller receives a 'ask-timeout' condition.

I think it should be possible to include a universal timestamp to the queue item for when the item is obsolete.
When it is obsolete, processing it can be discarded.

Care must be taken to not discard a queue item that has not timed out yet. So we should give it a few seconds more.

IDEA: we could spare the wheel-timer if we would raise the ask-timeout condition only in the above case and at the queue level.
The caveat would be that when an actor is 'asked' with a timeout of say 20 seconds, but the queue item is handled after 30 seconds, then the user would get the timeout just then, but not at 20 seconds as he specified.
So I think we should do this. The idea is still intriguing because of the saved timer resources.