mirror of
https://github.com/bitwarden/server.git
synced 2025-03-12 13:29:14 +01:00
Log SignalR pushes (#4392)
We are interested in the rate at which signalR notifications are pushed to clients. This enables tracking only of that rate and the type of notification, nothing more identifiable. Data will be used to determine feasibility of transferring to web push
This commit is contained in:
parent
563adf54af
commit
77dcf7f339
@ -65,7 +65,7 @@ public class AzureQueueHostedService : IHostedService, IDisposable
|
||||
try
|
||||
{
|
||||
await HubHelpers.SendNotificationToHubAsync(
|
||||
message.DecodeMessageText(), _hubContext, _anonymousHubContext, cancellationToken);
|
||||
message.DecodeMessageText(), _hubContext, _anonymousHubContext, _logger, cancellationToken);
|
||||
await _queueClient.DeleteMessageAsync(message.MessageId, message.PopReceipt);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -11,11 +11,13 @@ public class SendController : Controller
|
||||
{
|
||||
private readonly IHubContext<NotificationsHub> _hubContext;
|
||||
private readonly IHubContext<AnonymousNotificationsHub> _anonymousHubContext;
|
||||
private readonly ILogger<SendController> _logger;
|
||||
|
||||
public SendController(IHubContext<NotificationsHub> hubContext, IHubContext<AnonymousNotificationsHub> anonymousHubContext)
|
||||
public SendController(IHubContext<NotificationsHub> hubContext, IHubContext<AnonymousNotificationsHub> anonymousHubContext, ILogger<SendController> logger)
|
||||
{
|
||||
_hubContext = hubContext;
|
||||
_anonymousHubContext = anonymousHubContext;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpPost("~/send")]
|
||||
@ -27,7 +29,7 @@ public class SendController : Controller
|
||||
var notificationJson = await reader.ReadToEndAsync();
|
||||
if (!string.IsNullOrWhiteSpace(notificationJson))
|
||||
{
|
||||
await HubHelpers.SendNotificationToHubAsync(notificationJson, _hubContext, _anonymousHubContext);
|
||||
await HubHelpers.SendNotificationToHubAsync(notificationJson, _hubContext, _anonymousHubContext, _logger);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,12 @@ public static class HubHelpers
|
||||
string notificationJson,
|
||||
IHubContext<NotificationsHub> hubContext,
|
||||
IHubContext<AnonymousNotificationsHub> anonymousHubContext,
|
||||
ILogger logger,
|
||||
CancellationToken cancellationToken = default(CancellationToken)
|
||||
)
|
||||
{
|
||||
var notification = JsonSerializer.Deserialize<PushNotificationData<object>>(notificationJson, _deserializerOptions);
|
||||
logger.LogInformation("Sending notification: {NotificationType}", notification.Type);
|
||||
switch (notification.Type)
|
||||
{
|
||||
case PushType.SyncCipherUpdate:
|
||||
|
Loading…
Reference in New Issue
Block a user