feat(GODT-2442): add gRPC interface to send feedback.

This commit is contained in:
Jakub
2023-03-06 16:42:07 +01:00
parent 8c0bb22de3
commit f03688ba72
10 changed files with 1399 additions and 1122 deletions

View File

@ -90,6 +90,9 @@ type User struct {
syncWorkers int
showAllMail uint32
// doResyncFeedback must be non-blocking for first attempt (i.e. buffered)
doResyncFeedback chan bool
}
// New returns a new user.
@ -148,6 +151,8 @@ func New(
syncWorkers: syncWorkers,
showAllMail: b32(showAllMail),
doResyncFeedback: make(chan bool, 1),
}
// Initialize the user's update channels for its current address mode.
@ -299,6 +304,16 @@ func (user *User) SetAddressMode(_ context.Context, mode vault.AddressMode) erro
}, user.eventLock, user.apiAddrsLock, user.updateChLock)
}
// SendBadEventFeedback sends user feedback whether should do message re-sync.
func (user *User) SendBadEventFeedback(doResync bool) {
user.doResyncFeedback <- doResync
}
// GetBadEventFeedback read the user feedback whether should do message re-sync.
func (user *User) GetBadEventFeedback() bool {
return <-user.doResyncFeedback
}
// SetShowAllMail sets whether to show the All Mail mailbox.
func (user *User) SetShowAllMail(show bool) {
user.log.WithField("show", show).Info("Setting show all mail")