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:
parent
50e8d0aa90
commit
1315b0534d
|
@ -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(
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 7095b80cb6204c7b88012edbb3d97f59df330ddc
|
||||
Subproject commit 1aba03aed619b605a2f41eb02765d65756fff817
|
Loading…
Reference in New Issue