From ef245c3549457e19b9da781a7de72876193b3ccd Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 20 Oct 2017 15:32:16 +0100 Subject: [PATCH] Comments --- .../matrix-org/dendrite/syncapi/sync/userstream.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/syncapi/sync/userstream.go b/src/github.com/matrix-org/dendrite/syncapi/sync/userstream.go index 213a0387b..d4a8b29e2 100644 --- a/src/github.com/matrix-org/dendrite/syncapi/sync/userstream.go +++ b/src/github.com/matrix-org/dendrite/syncapi/sync/userstream.go @@ -28,11 +28,15 @@ import ( type UserStream struct { UserID string // The lock that protects changes to this struct - lock sync.Mutex - signalChannel chan struct{} - pos types.StreamPosition + lock sync.Mutex + // Closed when there is an update. + signalChannel chan struct{} + // The last stream position that there may have been an update for the suser + pos types.StreamPosition + // The last time when we had some listeners waiting timeOfLastChannel time.Time - numWaiting uint + // The number of listeners waiting + numWaiting uint } // UserStreamListener allows a sync request to wait for updates for a user.