Clean a bit

This commit is contained in:
2025-09-18 11:21:16 +07:00
parent 9ecaf09037
commit f1bb40fb75
4 changed files with 14 additions and 14 deletions

View File

@@ -13,6 +13,5 @@ public interface IPriceFetcherGrain : IGrainWithStringKey
/// Fetches price data for all supported exchange/ticker combinations
/// and publishes new candles to their respective streams.
/// </summary>
/// <returns>True if the operation completed successfully, false otherwise</returns>
Task<bool> FetchAndPublishPricesAsync();
Task FetchAndPublishPricesAsync();
}

View File

@@ -0,0 +1,5 @@
namespace Managing.Application.Bots;
public class BotReminderInitializer
{
}

View File

@@ -52,7 +52,8 @@ public class GeneticBacktestGrain : Grain, IGeneticBacktestGrain
request.Status = GeneticRequestStatus.Running;
await geneticService.UpdateGeneticRequestAsync(request);
request.User.Accounts = await ServiceScopeHelpers.WithScopedService<IAccountService, List<Account>>(_scopeFactory,
request.User.Accounts = await ServiceScopeHelpers.WithScopedService<IAccountService, List<Account>>(
_scopeFactory,
async accountService => (await accountService.GetAccountsByUserAsync(request.User)).ToList());
// Run GA
@@ -70,7 +71,8 @@ public class GeneticBacktestGrain : Grain, IGeneticBacktestGrain
}
catch (Exception ex)
{
_logger.LogError(ex, "[GeneticBacktestGrain] Error processing request {RequestId}", requestId);
SentrySdk.CaptureException(ex);
try
{
using var scope = _scopeFactory.CreateScope();

View File

@@ -81,12 +81,10 @@ public class PriceFetcherGrain : Grain, IPriceFetcherGrain, IRemindable
await base.OnDeactivateAsync(reason, cancellationToken);
}
public async Task<bool> FetchAndPublishPricesAsync()
public async Task FetchAndPublishPricesAsync()
{
try
{
_logger.LogInformation("Starting {timeframe} price fetch cycle", TargetTimeframe);
var fetchTasks = new List<Task>();
// Create fetch tasks for all exchange/ticker combinations for the target timeframe
@@ -100,16 +98,11 @@ public class PriceFetcherGrain : Grain, IPriceFetcherGrain, IRemindable
// Execute all fetch operations in parallel
await Task.WhenAll(fetchTasks);
_logger.LogInformation("{0} - Completed {1} price fetch cycle for {2} combinations",
nameof(PriceFetcherGrain), TargetTimeframe, fetchTasks.Count);
return true;
}
catch (Exception ex)
{
_logger.LogError(ex, "Error during price fetch cycle for timeframe {Timeframe}", TargetTimeframe);
return false;
SentrySdk.CaptureException(ex);
}
}
@@ -185,6 +178,7 @@ public class PriceFetcherGrain : Grain, IPriceFetcherGrain, IRemindable
{
_logger.LogError(ex, "Error fetching prices for {Exchange}-{Ticker}-{Timeframe}",
exchange, ticker, timeframe);
SentrySdk.CaptureException(ex);
}
}