feat: mailserver signals and improvements

- Remove unneded mailserver request when joining a channel
- Add extra details to mailserver logs (request id, and num batches)
- Add signal emitted each time a batch is processed
This commit is contained in:
Richard Ramos 2021-10-05 15:12:03 -04:00 committed by Iuri Matias
parent 50e8d0aa90
commit 1315b0534d
3 changed files with 11 additions and 15 deletions

View File

@ -188,16 +188,7 @@ proc handleChatEvents(self: ChatController) =
self.view.communities.markNotificationsAsRead(markAsReadProps)
proc handleMailserverEvents(self: ChatController) =
let mailserverWorker = self.appService.marathon[MailserverWorker().name]
# TODO: test mailserver topics when joining chat
self.status.events.on("channelJoined") do(e:Args):
let task = IsActiveMailserverAvailableTaskArg(
`method`: "isActiveMailserverAvailable",
vptr: cast[ByteAddress](self.view.vptr),
slot: "isActiveMailserverResult"
)
mailserverWorker.start(task)
let mailserverWorker = self.appService.marathon[MailserverWorker().name]
self.status.events.on("mailserverAvailable") do(e:Args):
self.view.messageView.setLoadingMessages(true)
let task = RequestMessagesTaskArg(

View File

@ -121,15 +121,20 @@ proc init*(self: ProfileController, account: Account) =
self.view.mailservers.activeMailserverChanged(mailserverArg.peer)
self.status.events.on(SignalType.HistoryRequestStarted.event) do(e: Args):
info "history request started", topics="mailserver-interaction"
let h = HistoryRequestStartedSignal(e)
info "history request started", topics="mailserver-interaction", requestId=h.requestId, numBatches=h.numBatches
self.status.events.on(SignalType.HistoryRequestBatchProcessed.event) do(e: Args):
let h = HistoryRequestBatchProcessedSignal(e)
info "history batch processed", topics="mailserver-interaction", requestId=h.requestId, batchIndex=h.batchIndex
self.status.events.on(SignalType.HistoryRequestCompleted.event) do(e: Args):
info "history request completed", topics="mailserver-interaction"
let h = HistoryRequestCompletedSignal(e)
info "history request completed", topics="mailserver-interaction", requestId=h.requestId
self.status.events.on(SignalType.HistoryRequestFailed.event) do(e: Args):
let h = HistoryRequestFailedSignal(e)
info "history request failed", topics="mailserver-interaction", errorMessage=h.errorMessage
info "history request failed", topics="mailserver-interaction", requestId=h.requestId, errorMessage=h.errorMessage
self.status.events.on(SignalType.Message.event) do(e: Args):
let msgData = MessageSignal(e);

2
vendor/status-lib vendored

@ -1 +1 @@
Subproject commit 7095b80cb6204c7b88012edbb3d97f59df330ddc
Subproject commit 1aba03aed619b605a2f41eb02765d65756fff817