Add cancellation token support across NordPool services and update constants for reuse
- Introduced `CancellationToken` to service methods for improved task cancellation handling. - Centralized reusable constants (`MinutesPerInterval`, `WaterReadyPowerThresholdWatts`) in `NordPoolConsts`. - Refactored `ConfigureAwait` usage and improved logging within `NordPoolEntityService`. - Adjusted tests to accommodate cancellation token changes.
This commit is contained in:
@@ -6,7 +6,6 @@ namespace NordPoolManager;
|
||||
|
||||
public class CheapestIntervalsFinder(ILogger<CheapestIntervalsFinder> logger) : ICheapestIntervalsFinder
|
||||
{
|
||||
private const double WaterReadyPowerThresholdWatts = 5.0;
|
||||
private const string SwitchOnState = "on";
|
||||
|
||||
public IReadOnlyList<CheapestIntervalResult> FindCheapestIntervals(NordPoolPrice prices, int numberOfIntervals, double priceCap, DateTime deadline)
|
||||
@@ -63,6 +62,6 @@ public class CheapestIntervalsFinder(ILogger<CheapestIntervalsFinder> logger) :
|
||||
return false;
|
||||
}
|
||||
|
||||
return string.Equals(switchState, SwitchOnState, StringComparison.OrdinalIgnoreCase) && powerWatts.Value < WaterReadyPowerThresholdWatts;
|
||||
return string.Equals(switchState, SwitchOnState, StringComparison.OrdinalIgnoreCase) && powerWatts.Value < NordPoolConsts.WaterReadyPowerThresholdWatts;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user