Other(refactor): Use normal value + mutex for user.apiLabels

This commit is contained in:
James Houlahan
2022-10-27 00:28:44 +02:00
parent 0bc99dbd4f
commit cab5ee6752
7 changed files with 230 additions and 99 deletions

View File

@ -59,9 +59,11 @@ type User struct {
apiAddrs map[string]liteapi.Address
apiAddrsLock sync.RWMutex
apiLabels *safe.Map[string, liteapi.Label]
updateCh *safe.Map[string, *queue.QueuedChannel[imap.Update]]
sendHash *sendRecorder
apiLabels map[string]liteapi.Label
apiLabelsLock sync.RWMutex
updateCh *safe.Map[string, *queue.QueuedChannel[imap.Update]]
sendHash *sendRecorder
tasks *xsync.Group
abortable async.Abortable
@ -138,7 +140,7 @@ func New(
apiUser: apiUser,
apiAddrs: groupBy(apiAddrs, func(addr liteapi.Address) string { return addr.ID }),
apiLabels: safe.NewMapFrom(groupBy(apiLabels, func(label liteapi.Label) string { return label.ID }), nil),
apiLabels: groupBy(apiLabels, func(label liteapi.Label) string { return label.ID }),
updateCh: safe.NewMapFrom(updateCh, nil),
sendHash: newSendRecorder(sendEntryExpiry),