Try fixing orleans server runtime

This commit is contained in:
2025-07-30 20:44:58 +07:00
parent 1071730978
commit 84f3e91dc6
3 changed files with 32 additions and 4 deletions

View File

@@ -409,7 +409,7 @@ public class LiveTradingBotGrain : Grain<TradingBotGrainState>, ITradingBotGrain
{
try
{
if (_tradingBot == null || State.Status != BotStatus.Up)
if (_tradingBot == null || State.Status != BotStatus.Up || _isDisposed)
{
return;
}
@@ -422,6 +422,12 @@ public class LiveTradingBotGrain : Grain<TradingBotGrainState>, ITradingBotGrain
await SaveBackupToState();
}
catch (ObjectDisposedException)
{
// Gracefully handle disposed service provider during shutdown
_logger.LogInformation("Service provider disposed during shutdown for LiveTradingBotGrain {GrainId}", this.GetPrimaryKey());
return;
}
catch (Exception ex)
{
_logger.LogError(ex, "Error during bot execution cycle for LiveTradingBotGrain {GrainId}", this.GetPrimaryKey());