mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-21 17:46:48 +00:00
GODT-2202: Report update errors from Gluon
For every update sent to gluon wait and check the error code to see if an error occurred. Note: Updates can't be inspect on the call site as it can lead to deadlocks.
This commit is contained in:
@ -23,8 +23,9 @@ import (
|
||||
)
|
||||
|
||||
type flusher struct {
|
||||
updateCh *queue.QueuedChannel[imap.Update]
|
||||
updates []*imap.MessageCreated
|
||||
updateCh *queue.QueuedChannel[imap.Update]
|
||||
updates []*imap.MessageCreated
|
||||
pushedUpdates []imap.Update
|
||||
|
||||
maxUpdateSize int
|
||||
curChunkSize int
|
||||
@ -47,8 +48,16 @@ func (f *flusher) push(update *imap.MessageCreated) {
|
||||
|
||||
func (f *flusher) flush() {
|
||||
if len(f.updates) > 0 {
|
||||
f.updateCh.Enqueue(imap.NewMessagesCreated(true, f.updates...))
|
||||
update := imap.NewMessagesCreated(true, f.updates...)
|
||||
f.updateCh.Enqueue(update)
|
||||
f.updates = nil
|
||||
f.curChunkSize = 0
|
||||
f.pushedUpdates = append(f.pushedUpdates, update)
|
||||
}
|
||||
}
|
||||
|
||||
func (f *flusher) collectPushedUpdates() []imap.Update {
|
||||
updates := f.pushedUpdates
|
||||
f.pushedUpdates = nil
|
||||
return updates
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user