Update logs

This commit is contained in:
2025-08-16 06:32:25 +07:00
parent 7271889bdf
commit 14f5cb0971
2 changed files with 14 additions and 15 deletions

View File

@@ -170,11 +170,8 @@ public class TradingBotBase : ITradingBot
{
ExecutionCount++;
Logger.LogInformation($"Date server : {DateTime.UtcNow} - Last candle date bot : {LastCandle.Date}");
Logger.LogInformation($"Signals : {Signals.Count}");
Logger.LogInformation($"ExecutionCount : {ExecutionCount}");
Logger.LogInformation($"Positions : {Positions.Count}");
Logger.LogInformation("__________________________________________________");
Logger.LogInformation("Bot Status - ServerDate: {ServerDate}, LastCandleDate: {LastCandleDate}, Signals: {SignalCount}, Executions: {ExecutionCount}, Positions: {PositionCount}",
DateTime.UtcNow, LastCandle.Date, Signals.Count, ExecutionCount, Positions.Count);
}
}

View File

@@ -97,10 +97,9 @@ public static class ApiBootstrap
return hostBuilder.UseOrleans(siloBuilder =>
{
// Configure clustering - force localhost clustering in development mode
if (!disableOrleansClustering && !string.IsNullOrEmpty(postgreSqlConnectionString) && isProduction)
// Configure clustering with improved networking or use localhost clustering if disabled
if (!disableOrleansClustering && !string.IsNullOrEmpty(postgreSqlConnectionString))
{
// Only use ADO.NET clustering in production
siloBuilder
.UseAdoNetClustering(options =>
{
@@ -110,12 +109,12 @@ public static class ApiBootstrap
}
else
{
// Use localhost clustering for development or when database is unavailable
// Fallback to localhost clustering for testing or when database is unavailable
siloBuilder.UseLocalhostClustering();
}
// Conditionally configure reminder service based on flag - only in production with ADO.NET clustering
if (runOrleansGrains && !disableOrleansClustering && !string.IsNullOrEmpty(postgreSqlConnectionString) && isProduction)
// Conditionally configure reminder service based on flag
if (runOrleansGrains && !disableOrleansClustering && !string.IsNullOrEmpty(postgreSqlConnectionString))
{
siloBuilder.UseAdoNetReminderService(options =>
{
@@ -165,6 +164,10 @@ public static class ApiBootstrap
options.ProbeTimeout = TimeSpan.FromSeconds(10);
options.IAmAliveTablePublishTimeout = TimeSpan.FromSeconds(30);
options.MaxJoinAttemptTime = TimeSpan.FromSeconds(120);
// Improved settings for development environments with stale members
options.DefunctSiloCleanupPeriod = TimeSpan.FromMinutes(1);
options.DefunctSiloExpiration = TimeSpan.FromMinutes(2);
})
.Configure<GatewayOptions>(options =>
{
@@ -212,10 +215,9 @@ public static class ApiBootstrap
});
}
// Configure grain storage - use ADO.NET for production or memory for development/fallback
if (!disableOrleansClustering && !string.IsNullOrEmpty(postgreSqlConnectionString) && isProduction)
// Configure grain storage - use ADO.NET for production or memory for fallback
if (!disableOrleansClustering && !string.IsNullOrEmpty(postgreSqlConnectionString))
{
// Use ADO.NET storage in production
siloBuilder
.AddAdoNetGrainStorage("bot-store", options =>
{
@@ -240,7 +242,7 @@ public static class ApiBootstrap
}
else
{
// Use memory storage for development or when database is unavailable
// Fallback to memory storage when database is unavailable
siloBuilder
.AddMemoryGrainStorage("bot-store")
.AddMemoryGrainStorage("registry-store")