Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make main loop frequency configurable - defaults to 10Hz. #355

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CA_DataUploaderLib/IOconf/IIOconf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public interface IIOconf
public string GetLoopName();
public string GetLoopServer();
public int GetVectorUploadDelay();
public int GetMainLoopDelay();
public CALogLevel GetOutputLevel();
public IEnumerable<IOconfMap> GetMap();
public IEnumerable<IOconfGeneric> GetGeneric();
Expand Down
2 changes: 1 addition & 1 deletion CA_DataUploaderLib/IOconf/IOconfFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public ConnectionInfo GetConnectionInfo()
public string GetLoopServer() => GetLoopConfig().Server;

public int GetVectorUploadDelay() => GetEntries<IOconfSamplingRates>().SingleOrDefault()?.VectorUploadDelay ?? 1000;
public int GetMainLoopDelay() => GetEntries<IOconfSamplingRates>().SingleOrDefault()?.MainLoopDelay ?? 200;
public int GetMainLoopDelay() => GetEntries<IOconfSamplingRates>().SingleOrDefault()?.MainLoopDelay ?? 100;
public CALogLevel GetOutputLevel() => GetLoopConfig().LogLevel;
public IEnumerable<IOconfMap> GetMap() => GetEntries<IOconfMap>();
public IEnumerable<IOconfGeneric> GetGeneric() => GetEntries<IOconfGeneric>();
Expand Down
4 changes: 2 additions & 2 deletions CA_DataUploaderLib/SingleNodeRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static async Task Run(IIOconf ioconf, CommandHandler cmdHandler, ServerUp
{
var alerts = new Alerts(ioconf, cmdHandler);
var subsystemsTask = Task.Run(() => cmdHandler.RunSubsystems(token), token);
var sendThrottle = new PeriodicTimer(TimeSpan.FromMilliseconds(100));
var sendThrottle = new PeriodicTimer(TimeSpan.FromMilliseconds(ioconf.GetMainLoopDelay()));
DataVector? vector = null;
var emptyCommands = new List<string>(0);

Expand All @@ -38,7 +38,7 @@ public static async Task Run(IIOconf ioconf, CommandHandler cmdHandler, ServerUp
uploader.SendEvent(uploader, new EventFiredArgs("User initiated uploader stop", EventType.Log, DateTime.UtcNow));
if (ex is not OperationCanceledException)
{
CALog.LoggerForUserOutput = new CALog.ConsoleLogger(); //we are about to stop the uploader, so we change inmediately to the console logger so the below already shows in the screen.
CALog.LoggerForUserOutput = new CALog.ConsoleLogger(); //we are about to stop the uploader, so we change immediately to the console logger so the below already shows in the screen.
CALog.LogErrorAndConsoleLn(LogID.B, "Error detected while stopping uploader", ex);
}
}
Expand Down