From 1315b0534de81d15ab58fdbdf49604d2e2a455ec Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Tue, 5 Oct 2021 15:12:03 -0400 Subject: [PATCH] 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 --- src/app/chat/event_handling.nim | 11 +---------- src/app/profile/core.nim | 13 +++++++++---- vendor/status-lib | 2 +- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/app/chat/event_handling.nim b/src/app/chat/event_handling.nim index 4b60da6321..cd80610ebf 100644 --- a/src/app/chat/event_handling.nim +++ b/src/app/chat/event_handling.nim @@ -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( diff --git a/src/app/profile/core.nim b/src/app/profile/core.nim index 4ef64bc5b9..dbc223666b 100644 --- a/src/app/profile/core.nim +++ b/src/app/profile/core.nim @@ -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); diff --git a/vendor/status-lib b/vendor/status-lib index 7095b80cb6..1aba03aed6 160000 --- a/vendor/status-lib +++ b/vendor/status-lib @@ -1 +1 @@ -Subproject commit 7095b80cb6204c7b88012edbb3d97f59df330ddc +Subproject commit 1aba03aed619b605a2f41eb02765d65756fff817