Is there a way to stop actors system with discarding messages in the message boxes? #88
Replies: 5 comments 13 replies
-
There are currently two ways how to stop an actor:
Unfortunately your scenario is not implemented. I didn't need it yet, but it would be good to be there and it's not hard to do (I think). |
Beta Was this translation helpful? Give feedback.
-
Ok. Here is where I need such feature. I'm building a cron-like addon for Sento. There is a macro defschedule, which can be used to define a schedule – right now it is a delay and a fbound symbol: (defun test-func ()
(with-log-unhandled ()
(let ((run-num (incf *run-num*))
(num-seconds 120))
(log:info "Sleeping" run-num num-seconds)
(sleep num-seconds)
(log:info "Sleeping Done" run-num))))
(defschedule *schedule*
(30 test-func)) Also, there are two functions:
And here are two moments:
Probably I'm overcomplicating and there is a simpler way to implement a cron-like system on actors? |
Beta Was this translation helpful? Give feedback.
-
Ok. I'll live without a stop function for now. Just wanted to let you know there is at least one more user of this feature :) |
Beta Was this translation helpful? Give feedback.
-
So, please check the latest code. This should work now. |
Beta Was this translation helpful? Give feedback.
-
Message discarding implemented as part of 94a9591 |
Beta Was this translation helpful? Give feedback.
-
I want to do a shutdown which will let actors finish their current tasks but will not let them to start new.
This is a small example of what I mean:
Currently, this code will wait 20 seconds while actor will process both messages sent to it before the call to
shutdown
function. But I want to shutdown as soon as possible, discarding both or at least the last message, sent to the actor.P.S. – I've tried to call
(sento.actor-cell:stop actor)
before shutdown, but it has no desired effect :(Beta Was this translation helpful? Give feedback.
All reactions