03-06-2026, 10:22 AM
Hallo,
I'm plan to use LibreAutomate-Nuget-Package inside a windows service to respond on third party windows etc. with configured ActionTriggers.
After creating the trigger functions, I'll call ActionTriggers.RunThread() infinitly. If the service itself should be terminating I currently see no option to inject a CancellationToken as it would be normally. Additionally the host machine use hybernating states and wakeup or resume later but normally never will be shutdown fully - so killing threads or creating zombies is not really a good option (also I look to prevent memory leaks).
I would therefore suggest to extend the library with following member function:
async Task ActionTrigger.ExecuteAsync(CancellationToken stoppingToken)
If there is already a way to safely cancel ActionTrigger Tasks by sending messages to thread or other solutions, I would love to know more about it.
Thanks in advance for any advice.
I'm plan to use LibreAutomate-Nuget-Package inside a windows service to respond on third party windows etc. with configured ActionTriggers.
After creating the trigger functions, I'll call ActionTriggers.RunThread() infinitly. If the service itself should be terminating I currently see no option to inject a CancellationToken as it would be normally. Additionally the host machine use hybernating states and wakeup or resume later but normally never will be shutdown fully - so killing threads or creating zombies is not really a good option (also I look to prevent memory leaks).
I would therefore suggest to extend the library with following member function:
async Task ActionTrigger.ExecuteAsync(CancellationToken stoppingToken)
If there is already a way to safely cancel ActionTrigger Tasks by sending messages to thread or other solutions, I would love to know more about it.
Thanks in advance for any advice.

How to terminate ActionTriggers right way