Skip to content

Commit

Permalink
log: Add logs when signaling sources is delayed too long.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrozev authored and damencho committed Mar 1, 2024
1 parent e4714fd commit 89c347c
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ import org.jitsi.xmpp.util.XmlStringBuilderUtil.Companion.toStringOpt
import org.jivesoftware.smack.packet.StanzaError
import org.jxmpp.jid.EntityFullJid
import java.time.Clock
import java.time.Duration
import java.time.Instant
import java.util.concurrent.ScheduledFuture
import java.util.concurrent.TimeUnit

Expand Down Expand Up @@ -247,8 +249,13 @@ open class Participant @JvmOverloads constructor(
synchronized(signalQueuedSourcesTaskSyncRoot) {
if (signalQueuedSourcesTask == null) {
logger.debug("Scheduling a task to signal queued remote sources after $delayMs ms.")
val timeOfSchedule = Instant.now()
signalQueuedSourcesTask = scheduledPool.schedule(
{
val actualDelayMs = Duration.between(timeOfSchedule, Instant.now()).toMillis()
if (actualDelayMs > delayMs + 3000) {
logger.warn("Scheduling of sources was delayed by $actualDelayMs ms (expected $delayMs)")
}
synchronized(signalQueuedSourcesTaskSyncRoot) {
sendQueuedRemoteSources()
signalQueuedSourcesTask = null
Expand Down

0 comments on commit 89c347c

Please sign in to comment.