From f653f33a6f1f70ff1eb32ba422a7e212435cec2f Mon Sep 17 00:00:00 2001 From: Him188 Date: Thu, 28 May 2020 13:50:52 +0800 Subject: [PATCH] Improve stability, returns -1 for sequenceId when failed to fetch from server --- .../net/mamoe/mirai/qqandroid/message/outgoingSourceImpl.kt | 4 ++-- .../kotlin/net.mamoe.mirai/message/data/MessageSource.kt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/outgoingSourceImpl.kt b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/outgoingSourceImpl.kt index b26951e7b..d79de032b 100644 --- a/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/outgoingSourceImpl.kt +++ b/mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/message/outgoingSourceImpl.kt @@ -128,8 +128,8 @@ internal class MessageSourceToGroupImpl( @OptIn(ExperimentalCoroutinesApi::class) override val sequenceId: Int get() = when { - sequenceIdDeferred.isCompleted -> sequenceIdDeferred.getCompleted() ?: 0 - !sequenceIdDeferred.isActive -> 0 + sequenceIdDeferred.isCompleted -> sequenceIdDeferred.getCompleted() ?: -1 + !sequenceIdDeferred.isActive -> -1 else -> error("sequenceId not yet available") } diff --git a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt index 032ed4878..a4ad9dad4 100644 --- a/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt +++ b/mirai-core/src/commonMain/kotlin/net.mamoe.mirai/message/data/MessageSource.kt @@ -76,7 +76,7 @@ sealed class MessageSource : Message, MessageMetadata, ConstrainSingle