From 7d53f1ba87ea34ecf7cb0c0bbfb9d0a14ca5b264 Mon Sep 17 00:00:00 2001 From: dimasm61 Date: Thu, 14 Dec 2023 15:06:10 +0300 Subject: [PATCH] feat: opportunity to realize graceful stopping IJobWorker instances --- Client/Api/Worker/IJobWorker.cs | 2 ++ Client/Impl/Worker/JobWorker.cs | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/Client/Api/Worker/IJobWorker.cs b/Client/Api/Worker/IJobWorker.cs index 899e5e1f..ba71c873 100644 --- a/Client/Api/Worker/IJobWorker.cs +++ b/Client/Api/Worker/IJobWorker.cs @@ -28,5 +28,7 @@ public interface IJobWorker : IDisposable /// true if this registration is not open and is not in the process of opening or closing bool IsClosed(); + + void StopPooling(); } } \ No newline at end of file diff --git a/Client/Impl/Worker/JobWorker.cs b/Client/Impl/Worker/JobWorker.cs index c005283d..70350ef0 100644 --- a/Client/Impl/Worker/JobWorker.cs +++ b/Client/Impl/Worker/JobWorker.cs @@ -87,6 +87,11 @@ public bool IsClosed() return !isRunning; } + public void StopPooling() + { + source.Cancel(); + } + /// /// Opens the configured JobWorker to activate jobs in the given poll interval /// and handle with the given handler.