Fix grain price fetcher
This commit is contained in:
@@ -10,6 +10,7 @@ using Managing.Application.Abstractions.Services;
|
||||
using Managing.Application.Accounts;
|
||||
using Managing.Application.Agents;
|
||||
using Managing.Application.Backtests;
|
||||
using Managing.Application.Grains;
|
||||
using Managing.Application.ManageBot;
|
||||
using Managing.Application.ManageBot.Commands;
|
||||
using Managing.Application.MoneyManagements;
|
||||
@@ -66,13 +67,12 @@ public static class ApiBootstrap
|
||||
.AddWorkers(configuration)
|
||||
.AddFluentValidation()
|
||||
.AddMediatR()
|
||||
.AddHostedServices()
|
||||
;
|
||||
}
|
||||
|
||||
private static IServiceCollection AddHostedServices(this IServiceCollection services)
|
||||
public static IServiceCollection AddHostedServices(this IServiceCollection services)
|
||||
{
|
||||
// services.AddHostedService<PriceFetcherInitializer>();
|
||||
services.AddHostedService<PriceFetcherInitializer>();
|
||||
return services;
|
||||
}
|
||||
|
||||
@@ -333,7 +333,10 @@ public static class ApiBootstrap
|
||||
services.AddTransient<IAccountService, AccountService>();
|
||||
services.AddTransient<ITradingService, TradingService>();
|
||||
services.AddTransient<IMessengerService, MessengerService>();
|
||||
services.AddTransient<ICandleRepository, CandleRepository>();
|
||||
// Use Singleton for InfluxDB repositories to prevent connection disposal issues in Orleans grains
|
||||
services.AddSingleton<IInfluxDbRepository, InfluxDbRepository>();
|
||||
services.AddSingleton<ICandleRepository, CandleRepository>();
|
||||
services.AddSingleton<IAgentBalanceRepository, AgentBalanceRepository>();
|
||||
});
|
||||
})
|
||||
;
|
||||
@@ -416,10 +419,10 @@ public static class ApiBootstrap
|
||||
services.AddTransient<IWorkerRepository, PostgreSqlWorkerRepository>();
|
||||
services.AddTransient<ISynthRepository, PostgreSqlSynthRepository>();
|
||||
|
||||
// InfluxDb Repositories
|
||||
services.AddTransient<IInfluxDbRepository, InfluxDbRepository>();
|
||||
services.AddTransient<ICandleRepository, CandleRepository>();
|
||||
services.AddTransient<IAgentBalanceRepository, AgentBalanceRepository>();
|
||||
// InfluxDb Repositories - Use Singleton for proper connection management in Orleans grains
|
||||
services.AddSingleton<IInfluxDbRepository, InfluxDbRepository>();
|
||||
services.AddSingleton<ICandleRepository, CandleRepository>();
|
||||
services.AddSingleton<IAgentBalanceRepository, AgentBalanceRepository>();
|
||||
|
||||
// Cache
|
||||
services.AddDistributedMemoryCache();
|
||||
|
||||
Reference in New Issue
Block a user