(ctx context.Context, s *LocalSubscriber)
| 371 | } |
| 372 | |
| 373 | func (h *Hub) shutdown(ctx context.Context, s *LocalSubscriber) { |
| 374 | // Notify that the client is closing the connection |
| 375 | s.Disconnect() |
| 376 | |
| 377 | ctx = context.WithoutCancel(ctx) |
| 378 | |
| 379 | if err := h.transport.RemoveSubscriber(ctx, s); err != nil && h.logger.Enabled(ctx, slog.LevelError) { |
| 380 | h.logger.LogAttrs(ctx, slog.LevelError, "Failed to remove subscriber on shutdown", slog.Any("error", err)) |
| 381 | } |
| 382 | |
| 383 | h.dispatchSubscriptionUpdate(ctx, s, false) |
| 384 | |
| 385 | if h.logger.Enabled(ctx, slog.LevelInfo) { |
| 386 | h.logger.LogAttrs(ctx, slog.LevelInfo, "Subscriber disconnected") |
| 387 | } |
| 388 | |
| 389 | h.metrics.SubscriberDisconnected(s) |
| 390 | } |
| 391 | |
| 392 | func (h *Hub) dispatchSubscriptionUpdate(ctx context.Context, s *LocalSubscriber, active bool) { |
| 393 | if !h.subscriptions { |
no test coverage detected