From e91e646660d611313b2f7163c279b669e605f774 Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Fri, 2 Sep 2022 10:41:33 +0800 Subject: [PATCH] adjusting dependency order --- .../Abp/IM/SignalR/Hubs/MessagesHub.cs | 28 +++++++++++++++++-- .../RealtimeMessageHttpApiHostModule.cs | 2 +- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs index 68771cc76..db59f19bb 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs @@ -6,6 +6,7 @@ using LINGYUN.Abp.IM.Messages; using LINGYUN.Abp.RealTime.Localization; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.SignalR; +using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using System; using System.Collections.Generic; @@ -44,14 +45,28 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs { await base.OnConnectedAsync(); - await SendUserOnlineStateAsync(); + try + { + await SendUserOnlineStateAsync(); + } + catch(Exception ex) + { + Logger.LogWarning("An error occurred in the OnConnected method:{message}", ex.Message); + } } public override async Task OnDisconnectedAsync(Exception exception) { await base.OnDisconnectedAsync(exception); - await SendUserOnlineStateAsync(false); + try + { + await SendUserOnlineStateAsync(false); + } + catch (Exception ex) + { + Logger.LogWarning("An error occurred in the OnDisconnected method:{message}", ex.Message); + } } protected virtual async Task SendUserOnlineStateAsync(bool isOnlined = true) @@ -164,7 +179,14 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs [HubMethodName("read")] public virtual async Task ReadAsync(ChatMessage chatMessage) { - await Processor?.ReadAsync(chatMessage); + try + { + await Processor?.ReadAsync(chatMessage); + } + catch (Exception ex) + { + Logger.LogWarning("An error occurred in the Read method:{message}", ex.Message); + } } protected virtual async Task SendMessageAsync(string methodName, ChatMessage chatMessage, bool callbackException = false) diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs index b2847ccee..1f3830135 100644 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs +++ b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs @@ -62,12 +62,12 @@ namespace LY.MicroService.RealtimeMessage; typeof(AbpBackgroundTasksExceptionHandlingModule), typeof(TaskManagementEntityFrameworkCoreModule), typeof(AbpMessageServiceEntityFrameworkCoreModule), - typeof(AbpIdentityEntityFrameworkCoreModule), typeof(AbpSaasEntityFrameworkCoreModule), typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpPermissionManagementEntityFrameworkCoreModule), typeof(AbpLocalizationManagementEntityFrameworkCoreModule), typeof(AbpTextTemplatingEntityFrameworkCoreModule), + typeof(AbpIdentityEntityFrameworkCoreModule), typeof(AbpDataDbMigratorModule), typeof(AbpAspNetCoreAuthenticationJwtBearerModule), typeof(AbpAuthorizationOrganizationUnitsModule),