From cc95ebe1e4b33be0d602dd105f9c2d61b90be29d Mon Sep 17 00:00:00 2001 From: Kegan Dougal <7190048+kegsay@users.noreply.github.com> Date: Fri, 24 Nov 2023 15:23:35 +0000 Subject: [PATCH] Review comments --- sync3/connmap.go | 3 +++ sync3/connmap_test.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sync3/connmap.go b/sync3/connmap.go index cf5ecf5..287770f 100644 --- a/sync3/connmap.go +++ b/sync3/connmap.go @@ -8,6 +8,7 @@ import ( "golang.org/x/exp/slices" "github.com/ReneKroon/ttlcache/v2" + "github.com/matrix-org/sliding-sync/internal" "github.com/prometheus/client_golang/prometheus" ) @@ -169,6 +170,7 @@ func (m *ConnMap) CloseConnsForDevice(userID, deviceID string) { err := m.cache.Remove(cid.String()) // this will fire TTL callbacks which calls closeConn if err != nil { logger.Err(err).Str("cid", cid.String()).Msg("CloseConnsForDevice: cid did not exist in ttlcache") + internal.GetSentryHubFromContextOrDefault(context.Background()).CaptureException(err) } } } @@ -199,6 +201,7 @@ func (m *ConnMap) CloseConnsForUsers(userIDs []string) (closed int) { err := m.cache.Remove(conn.String()) // this will fire TTL callbacks which calls closeConn if err != nil { logger.Err(err).Str("cid", conn.String()).Msg("CloseConnsForDevice: cid did not exist in ttlcache") + internal.GetSentryHubFromContextOrDefault(context.Background()).CaptureException(err) } } closed += len(conns) diff --git a/sync3/connmap_test.go b/sync3/connmap_test.go index 9806493..da6ff36 100644 --- a/sync3/connmap_test.go +++ b/sync3/connmap_test.go @@ -87,7 +87,7 @@ func TestConnMap_CloseConnsForUser(t *testing.T) { time.Sleep(100 * time.Millisecond) // some stuff happens asyncly in goroutines must.Equal(t, num, 6, "unexpected number of closed conns") - // Destroy should have been called for all alice|A connections + // Destroy should have been called for all alice connections assertDestroyedConns(t, cidToConn, func(cid ConnID) bool { return cid.UserID == alice })