feat(GODT-2801): Debug names for QueuedChannels

https://github.com/ProtonMail/gluon/pull/385
https://github.com/ProtonMail/go-proton-api/pull/90
This commit is contained in:
Leander Beernaert
2023-07-24 15:34:02 +02:00
parent 040ddadb7a
commit 776976a8a2
6 changed files with 35 additions and 15 deletions

View File

@ -217,7 +217,12 @@ func (user *User) handleCreateAddressEvent(ctx context.Context, event proton.Add
user.updateCh[event.Address.ID] = user.updateCh[primAddr.ID]
case vault.SplitMode:
user.updateCh[event.Address.ID] = async.NewQueuedChannel[imap.Update](0, 0, user.panicHandler)
user.updateCh[event.Address.ID] = async.NewQueuedChannel[imap.Update](
0,
0,
user.panicHandler,
fmt.Sprintf("user-update-split-%v", event.Address.ID),
)
}
user.eventCh.Enqueue(events.UserAddressCreated{
@ -276,7 +281,12 @@ func (user *User) handleUpdateAddressEvent(_ context.Context, event proton.Addre
user.updateCh[event.Address.ID] = user.updateCh[primAddr.ID]
case vault.SplitMode:
user.updateCh[event.Address.ID] = async.NewQueuedChannel[imap.Update](0, 0, user.panicHandler)
user.updateCh[event.Address.ID] = async.NewQueuedChannel[imap.Update](
0,
0,
user.panicHandler,
fmt.Sprintf("user-update-split-%v", event.Address.ID),
)
}
user.eventCh.Enqueue(events.UserAddressEnabled{

View File

@ -155,7 +155,7 @@ func New(
reporter: reporter,
sendHash: sendrecorder.NewSendRecorder(sendrecorder.SendEntryExpiry),
eventCh: async.NewQueuedChannel[events.Event](0, 0, crashHandler),
eventCh: async.NewQueuedChannel[events.Event](0, 0, crashHandler, fmt.Sprintf("bridge-user-%v", apiUser.ID)),
eventLock: safe.NewRWMutex(),
apiUser: apiUser,
@ -687,7 +687,12 @@ func (user *User) initUpdateCh(mode vault.AddressMode) {
switch mode {
case vault.CombinedMode:
primaryUpdateCh := async.NewQueuedChannel[imap.Update](0, 0, user.panicHandler)
primaryUpdateCh := async.NewQueuedChannel[imap.Update](
0,
0,
user.panicHandler,
"user-update-combined",
)
for addrID := range user.apiAddrs {
user.updateCh[addrID] = primaryUpdateCh
@ -695,7 +700,12 @@ func (user *User) initUpdateCh(mode vault.AddressMode) {
case vault.SplitMode:
for addrID := range user.apiAddrs {
user.updateCh[addrID] = async.NewQueuedChannel[imap.Update](0, 0, user.panicHandler)
user.updateCh[addrID] = async.NewQueuedChannel[imap.Update](
0,
0,
user.panicHandler,
fmt.Sprintf("user-update-split-%v", addrID),
)
}
}
}