fix(@desktop): windows application unresponsive when fetching Status updates
This commit is contained in:
parent
511c959121
commit
cd423336e1
|
@ -9,6 +9,7 @@ import ../../../status/utils as status_utils
|
||||||
import ../../../status/chat/[chat, message]
|
import ../../../status/chat/[chat, message]
|
||||||
import ../../../status/profile/profile
|
import ../../../status/profile/profile
|
||||||
import ../../../status/tasks/[qt, task_runner_impl]
|
import ../../../status/tasks/[qt, task_runner_impl]
|
||||||
|
import ../../../status/tasks/marathon/mailserver/worker
|
||||||
|
|
||||||
import communities, chat_item, channels_list, communities, community_list, message_list, channel, message_item
|
import communities, chat_item, channels_list, communities, community_list, message_list, channel, message_item
|
||||||
|
|
||||||
|
@ -375,9 +376,10 @@ QtObject:
|
||||||
notify = loadingMessagesChanged
|
notify = loadingMessagesChanged
|
||||||
|
|
||||||
proc fillGaps*(self: MessageView, messageId: string) {.slot.} =
|
proc fillGaps*(self: MessageView, messageId: string) {.slot.} =
|
||||||
self.loadingMessages = true
|
self.setLoadingMessages(true)
|
||||||
self.loadingMessagesChanged(true)
|
let mailserverWorker = self.status.tasks.marathon[MailserverWorker().name]
|
||||||
discard self.status.mailservers.fillGaps(self.channelView.activeChannel.id, @[messageId])
|
let task = FillGapsTaskArg( `method`: "fillGaps", chatId: self.channelView.activeChannel.id, messageIds: @[messageId])
|
||||||
|
mailserverWorker.start(task)
|
||||||
|
|
||||||
proc unreadMessages*(self: MessageView): int {.slot.} =
|
proc unreadMessages*(self: MessageView): int {.slot.} =
|
||||||
result = self.unreadMessageCnt
|
result = self.unreadMessageCnt
|
||||||
|
|
|
@ -150,6 +150,10 @@ proc requestMoreMessages*(self: MailserverModel, chatId: string) =
|
||||||
debug "Requesting more messages from", mailserver=self.activeMailserver, chatId=chatId
|
debug "Requesting more messages from", mailserver=self.activeMailserver, chatId=chatId
|
||||||
discard status_mailservers.syncChatFromSyncedFrom(chatId)
|
discard status_mailservers.syncChatFromSyncedFrom(chatId)
|
||||||
|
|
||||||
|
proc fillGaps*(self: MailserverModel, chatId: string, messageIds: seq[string]) =
|
||||||
|
debug "Requesting fill gaps from", mailserver=self.activeMailserver, chatId=chatId
|
||||||
|
discard status_mailservers.fillGaps(chatId, messageIds)
|
||||||
|
|
||||||
proc findNewMailserver(self: MailserverModel) =
|
proc findNewMailserver(self: MailserverModel) =
|
||||||
warn "Finding a new mailserver..."
|
warn "Finding a new mailserver..."
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,9 @@ type
|
||||||
GetActiveMailserverTaskArg* = ref object of MarathonTaskArg
|
GetActiveMailserverTaskArg* = ref object of MarathonTaskArg
|
||||||
RequestMessagesTaskArg* = ref object of MarathonTaskArg
|
RequestMessagesTaskArg* = ref object of MarathonTaskArg
|
||||||
chatId*: string
|
chatId*: string
|
||||||
|
FillGapsTaskArg* = ref object of MarathonTaskArg
|
||||||
|
chatId*: string
|
||||||
|
messageIds*: seq[string]
|
||||||
AddMailserverTopicTaskArg* = ref object of MarathonTaskArg
|
AddMailserverTopicTaskArg* = ref object of MarathonTaskArg
|
||||||
PeerSummaryChangeTaskArg* = ref object of MarathonTaskArg
|
PeerSummaryChangeTaskArg* = ref object of MarathonTaskArg
|
||||||
peers*: seq[string]
|
peers*: seq[string]
|
||||||
|
@ -97,6 +100,10 @@ proc processMessage(mailserverModel: MailserverModel, received: string) =
|
||||||
let taskArg = decode[RequestMessagesTaskArg](received)
|
let taskArg = decode[RequestMessagesTaskArg](received)
|
||||||
mailserverModel.requestMoreMessages(taskArg.chatId)
|
mailserverModel.requestMoreMessages(taskArg.chatId)
|
||||||
|
|
||||||
|
of "fillGaps":
|
||||||
|
let taskArg = decode[FillGapsTaskArg](received)
|
||||||
|
mailserverModel.fillGaps(taskArg.chatId, taskArg.messageIds)
|
||||||
|
|
||||||
of "getActiveMailserver":
|
of "getActiveMailserver":
|
||||||
let
|
let
|
||||||
taskArg = decode[GetActiveMailserverTaskArg](received)
|
taskArg = decode[GetActiveMailserverTaskArg](received)
|
||||||
|
|
|
@ -164,5 +164,14 @@ ScrollView {
|
||||||
timeout: model.timeout
|
timeout: model.timeout
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
active: chatsModel.messageView.loadingMessages
|
||||||
|
sourceComponent: LoadingAnimation {}
|
||||||
|
anchors.right: timelineContainer.right
|
||||||
|
anchors.top: statusUpdateInput.bottom
|
||||||
|
anchors.rightMargin: Style.current.padding
|
||||||
|
anchors.topMargin: Style.current.padding
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue