Renamed Call Start and Stop to Enable and Disable

This commit is contained in:
2025-08-31 02:51:49 +02:00
parent 2187a59936
commit 92bf48d06a
4 changed files with 16 additions and 16 deletions

View File

@@ -25,13 +25,13 @@ public class RunOnceCall : ICall
IndexAsync(); IndexAsync();
} }
public void Start() public void Enable()
{ {
IndexAsync(); IndexAsync();
IsEnabled = true; IsEnabled = true;
} }
public void Stop() public void Disable()
{ {
IsEnabled = false; IsEnabled = false;
} }
@@ -128,13 +128,13 @@ public class IntervalCall : ICall
}; };
} }
public void Start() public void Enable()
{ {
Timer.Start(); Timer.Start();
IsEnabled = true; IsEnabled = true;
} }
public void Stop() public void Disable()
{ {
Scriptable.Stop(); Scriptable.Stop();
Timer.Stop(); Timer.Stop();
@@ -218,10 +218,10 @@ public class ScheduleCall : ICall
} }
}; };
CreateJob().Wait(); CreateJob().Wait();
Start(); Enable();
} }
public void Start() public void Enable()
{ {
if (!IsEnabled) if (!IsEnabled)
{ {
@@ -230,7 +230,7 @@ public class ScheduleCall : ICall
} }
} }
public void Stop() public void Disable()
{ {
Scheduler.PauseAll(); Scheduler.PauseAll();
IsEnabled = false; IsEnabled = false;
@@ -317,7 +317,7 @@ public class FileUpdateCall : ICall
_watcher.EnableRaisingEvents = true; _watcher.EnableRaisingEvents = true;
} }
public void Start() public void Enable()
{ {
if (!IsEnabled) if (!IsEnabled)
{ {
@@ -327,7 +327,7 @@ public class FileUpdateCall : ICall
} }
} }
public void Stop() public void Disable()
{ {
if (IsEnabled) if (IsEnabled)
{ {

View File

@@ -67,7 +67,7 @@ public class CallsController : ControllerBase
_logger.LogInformation("Starting calls in worker {workerName}.", [workerName]); _logger.LogInformation("Starting calls in worker {workerName}.", [workerName]);
foreach (ICall call in worker.Calls) foreach (ICall call in worker.Calls)
{ {
call.Start(); call.Enable();
} }
_logger.LogInformation("Finished starting calls in worker {workerName}.", [workerName]); _logger.LogInformation("Finished starting calls in worker {workerName}.", [workerName]);
} }
@@ -81,7 +81,7 @@ public class CallsController : ControllerBase
return new CallEnableResult { Success = false }; return new CallEnableResult { Success = false };
} }
_logger.LogInformation("Starting call {callName} in worker {workerName}.", [callName, workerName]); _logger.LogInformation("Starting call {callName} in worker {workerName}.", [callName, workerName]);
call.Start(); call.Enable();
} }
return new CallEnableResult { Success = true }; return new CallEnableResult { Success = true };
} }
@@ -100,7 +100,7 @@ public class CallsController : ControllerBase
_logger.LogInformation("Stopping calls in worker {name}.", [workerName]); _logger.LogInformation("Stopping calls in worker {name}.", [workerName]);
foreach (ICall call in worker.Calls) foreach (ICall call in worker.Calls)
{ {
call.Stop(); call.Disable();
} }
_logger.LogInformation("Stopped calls in worker {name}.", [workerName]); _logger.LogInformation("Stopped calls in worker {name}.", [workerName]);
} else } else
@@ -113,7 +113,7 @@ public class CallsController : ControllerBase
return new CallDisableResult { Success = false }; return new CallDisableResult { Success = false };
} }
_logger.LogInformation("Starting call {callName} in worker {workerName}.", [callName, workerName]); _logger.LogInformation("Starting call {callName} in worker {workerName}.", [callName, workerName]);
call.Stop(); call.Disable();
} }
return new CallDisableResult { Success = true }; return new CallDisableResult { Success = true };
} }

View File

@@ -36,7 +36,7 @@ public class ConfigController : ControllerBase
Worker worker = workerKVPair.Value; Worker worker = workerKVPair.Value;
foreach (ICall call in worker.Calls) foreach (ICall call in worker.Calls)
{ {
call.Stop(); call.Disable();
call.Dispose(); call.Dispose();
} }
worker.Calls.Clear(); worker.Calls.Clear();

View File

@@ -16,8 +16,8 @@ public class CallConfig
public interface ICall public interface ICall
{ {
public HealthCheckResult HealthCheck(); public HealthCheckResult HealthCheck();
public void Start(); public void Enable();
public void Stop(); public void Disable();
public void Dispose(); public void Dispose();
public string Name { get; set; } public string Name { get; set; }
public bool IsEnabled { get; set; } public bool IsEnabled { get; set; }