From e5591eef3850a9796cc87386128651a828b70697 Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Fri, 6 Oct 2023 18:29:15 +0200 Subject: Small refactors --- .../LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Utilities/LibMatrix.Utilities.Bot/Services') diff --git a/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs b/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs index 910db0a..0dcf3e3 100644 --- a/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs +++ b/Utilities/LibMatrix.Utilities.Bot/Services/CommandListenerHostedService.cs @@ -37,7 +37,8 @@ public class CommandListenerHostedService : IHostedService { private async Task? Run(CancellationToken cancellationToken) { _logger.LogInformation("Starting command listener!"); - _hs.SyncHelper.TimelineEventHandlers.Add(async @event => { + var syncHelper = new SyncHelper(_hs); + syncHelper.TimelineEventHandlers.Add(async @event => { try { var room = _hs.GetRoom(@event.RoomId); // _logger.LogInformation(eventResponse.ToJson(indent: false)); @@ -80,7 +81,7 @@ public class CommandListenerHostedService : IHostedService { _logger.LogError(e, "Error in command listener!"); } }); - await _hs.SyncHelper.RunSyncLoop(cancellationToken: cancellationToken); + await new SyncHelper(_hs).RunSyncLoopAsync(cancellationToken: cancellationToken); } /// Triggered when the application host is performing a graceful shutdown. -- cgit 1.4.1