Fixup comments

This commit is contained in:
David Robertson 2023-05-15 15:39:08 +01:00
parent 99f5206063
commit 5503b9d10b
No known key found for this signature in database
GPG Key ID: 903ECE108A39DEDD
2 changed files with 2 additions and 7 deletions

View File

@ -149,13 +149,13 @@ func (h *PollerMap) NumPollers() (count int) {
return
}
// EnsurePolling makes sure there is a poller for this user, making one if need be.
// EnsurePolling makes sure there is a poller for this device, making one if need be.
// Blocks until at least 1 sync is done if and only if the poller was just created.
// This ensures that calls to the database will return data.
// Guarantees only 1 poller will be running per deviceID.
// Note that we will immediately return if there is a poller for the same user but a different device.
// We do this to allow for logins on clients to be snappy fast, even though they won't yet have the
// to-device msgs to decrypt E2EE roms.
// to-device msgs to decrypt E2EE rooms.
func (h *PollerMap) EnsurePolling(pid PollerID, accessToken, v2since string, isStartup bool, logger zerolog.Logger) {
h.pollerMu.Lock()
if !h.executorRunning {

View File

@ -44,11 +44,6 @@ func NewEnsurePoller(notifier pubsub.Notifier) *EnsurePoller {
func (p *EnsurePoller) EnsurePolling(pid sync2.PollerID, tokenHash string) {
p.mu.Lock()
// do we need to wait?
// TODO: this lookup is based on (user, device) pair. If the same user logs in on
// another device, we will wait for the poller to make an initial sync. We could do
// better here by using the data we've accumulated for the first device. However
// that wouldn't include any to-device messages, so encrypted messages would be
// undecrypted.
if p.pendingPolls[pid].done {
p.mu.Unlock()
return