Skip to content

Commit

Permalink
Small fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-cebo committed Oct 10, 2024
1 parent b6fb0a3 commit 95a1738
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ abstract class BaseChannel<C : Channel, M : Message>(
}
private val channelFilterString get() = "channel.id == '${this.id}'"
private val typingTimeout get() = maxOf(chat.config.typingTimeout, MINIMAL_TYPING_INDICATOR_TIMEOUT)
private val typingTimoutMargin = 500.milliseconds // sendTypingSignal 500 millis before typingTimeout expires to ensure continuity

override fun update(
name: String?,
Expand All @@ -147,11 +148,9 @@ abstract class BaseChannel<C : Channel, M : Message>(
if (type == ChannelType.PUBLIC) {
return log.logErrorAndReturnException(TYPING_INDICATORS_NO_SUPPORTED_IN_PUBLIC_CHATS).asFuture()
}

val now = clock.now()

typingSent?.let { typingSentNotNull: Instant ->
val typingTimoutMargin = 500.milliseconds // sendTypingSignal 500 millis before typingTimeout expires to ensure continuity
if (!timeoutElapsed(typingTimeout - typingTimoutMargin, typingSentNotNull, now)) {
return Unit.asFuture()
}
Expand Down

0 comments on commit 95a1738

Please sign in to comment.