logging share errors
This commit is contained in:
parent
950bc1bd4a
commit
925c708b67
2 changed files with 19 additions and 8 deletions
|
@ -540,14 +540,24 @@ class TelegramSettings(private val app: TelegramApplication) {
|
|||
if (initTime && initSending) {
|
||||
initializing = true
|
||||
} else {
|
||||
var waitingTimeError = false
|
||||
val maxWaitingTime = WAITING_TDLIB_TIME * MAX_MESSAGES_IN_TDLIB_PER_CHAT * max(1, chatsCount)
|
||||
val textSharingError = !shareInfo.lastTextMessageHandled && currentTime - shareInfo.lastSendTextMessageTime > maxWaitingTime
|
||||
val mapSharingError = !shareInfo.lastMapMessageHandled && currentTime - shareInfo.lastSendMapMessageTime > maxWaitingTime
|
||||
if (shareInfo.hasSharingError
|
||||
|| (shareTypeValue == SHARE_TYPE_MAP_AND_TEXT && (textSharingError || mapSharingError))
|
||||
|| textSharingError && (shareTypeValue == SHARE_TYPE_TEXT)
|
||||
|| mapSharingError && (shareTypeValue == SHARE_TYPE_MAP)
|
||||
) {
|
||||
val textSharingWaitingTime = currentTime - shareInfo.lastSendTextMessageTime
|
||||
val mapSharingWaitingTime = currentTime - shareInfo.lastSendMapMessageTime
|
||||
val textSharingError = !shareInfo.lastTextMessageHandled && textSharingWaitingTime > maxWaitingTime
|
||||
val mapSharingError = !shareInfo.lastMapMessageHandled && mapSharingWaitingTime > maxWaitingTime
|
||||
if ((shareTypeValue == SHARE_TYPE_MAP_AND_TEXT && (textSharingError || mapSharingError))
|
||||
|| textSharingError && (shareTypeValue == SHARE_TYPE_TEXT)
|
||||
|| mapSharingError && (shareTypeValue == SHARE_TYPE_MAP)) {
|
||||
waitingTimeError = true
|
||||
log.debug("Send chats error for share type \"$shareTypeValue\"" +
|
||||
"\nMax waiting time: ${maxWaitingTime}s" +
|
||||
"\nLast text message handled: ${shareInfo.lastTextMessageHandled}" +
|
||||
"\nText sharing waiting time: ${textSharingWaitingTime}s" +
|
||||
"\nLast map message handled: ${shareInfo.lastMapMessageHandled}" +
|
||||
"\nMap sharing waiting time: ${mapSharingWaitingTime}s")
|
||||
}
|
||||
if (shareInfo.hasSharingError || waitingTimeError) {
|
||||
sendChatsErrors = true
|
||||
locationTime = max(shareInfo.lastTextSuccessfulSendTime, shareInfo.lastMapSuccessfulSendTime)
|
||||
chatsIds.add(shareInfo.chatId)
|
||||
|
|
|
@ -776,6 +776,7 @@ class TelegramHelper private constructor() {
|
|||
client?.send(TdApi.CreatePrivateChat(userId, false)) { obj ->
|
||||
when (obj.constructor) {
|
||||
TdApi.Error.CONSTRUCTOR -> {
|
||||
log.debug("createPrivateChatWithUser ERROR $obj")
|
||||
val error = obj as TdApi.Error
|
||||
if (error.code != IGNORED_ERROR_CODE) {
|
||||
shareInfo.hasSharingError = true
|
||||
|
@ -969,7 +970,7 @@ class TelegramHelper private constructor() {
|
|||
val messageType = if (isBot) MESSAGE_TYPE_BOT else MESSAGE_TYPE_TEXT
|
||||
when (obj.constructor) {
|
||||
TdApi.Error.CONSTRUCTOR -> {
|
||||
log.debug("handleTextLocationMessageUpdate - ERROR")
|
||||
log.debug("handleTextLocationMessageUpdate - ERROR $obj")
|
||||
val error = obj as TdApi.Error
|
||||
if (error.code != IGNORED_ERROR_CODE) {
|
||||
shareInfo.hasSharingError = true
|
||||
|
|
Loading…
Reference in a new issue