瀏覽代碼

add retention worker

Dalibor Votruba 3 年之前
父節點
當前提交
0532d3a37c
共有 2 個文件被更改,包括 28 次插入3 次删除
  1. 6 2
      ProcessServer/Business/Server.cs
  2. 22 1
      ProcessServer/Business/Workers/RetentionWorker.cs

+ 6 - 2
ProcessServer/Business/Server.cs

@@ -75,7 +75,10 @@ namespace BO.ProcessServer.Business
             LogDebug($"Starting instance '{_configuration.System.Identification}' ...");
 
             _wkPull.Start();
-            _wkRetention.Start();
+            if (_configuration.System.Retention.Enabled)
+                _wkRetention.Start();
+            else
+                LogWarn("Retention module is disabled by configuration.");
             _wkProcessing.Start();
 
             Statistics.GetCounter<TimespanCounter>(Statistics.CNT_PS_ONLINE_DUR).Start();
@@ -211,7 +214,8 @@ namespace BO.ProcessServer.Business
         private void StopAll(bool silently = false)
         {
             _wkPull.Stop(silently);
-            _wkRetention.Stop(silently);
+            if (_configuration.System.Retention.Enabled)
+                _wkRetention.Stop(silently);
             _wkProcessing.Stop(silently);
 
             foreach (var process in _processes)

+ 22 - 1
ProcessServer/Business/Workers/RetentionWorker.cs

@@ -1,13 +1,21 @@
-using Quadarax.Foundation.Core.Logging;
+using System.Threading.Tasks;
+using BO.ProcessServer.Business.Workers.Contexts;
+using Quadarax.Foundation.Core.Logging;
 using Quadarax.Foundation.Core.Thread;
 
 namespace BO.ProcessServer.Business.Workers
 {
     public class RetentionWorker : LoopWorker
     {
+        #region *** Constants ***
         private const string CS_WK_NAME = "Retention";
+        #endregion
+
+        #region *** Constuctors ***
         public RetentionWorker(IWorkerContext context) : base(CS_WK_NAME, context)
         {
+            var ctx = (CfgCtx)context;
+            ctx.Configuration.System.Retention.
         }
 
         public RetentionWorker(string workerName, IWorkerContext context) : base(workerName, context)
@@ -21,5 +29,18 @@ namespace BO.ProcessServer.Business.Workers
         public RetentionWorker(string workerName, IWorkerContext context, ILogger logger = null) : base(workerName, context, logger)
         {
         }
+        #endregion
+
+        #region *** Iteration ***
+        protected override async Task DoIteration(IWorkerContext context)
+        {
+            var ctx = (CfgCtx)context;
+
+
+
+
+        }
+
+        #endregion
     }
 }