Skip to content

Commit

Permalink
check if session is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
greenart7c3 committed Feb 16, 2024
1 parent a06e511 commit b78a463
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.greenart7c3.citrine

import EOSE
import android.util.Log
import com.vitorpamplona.quartz.utils.TimeUtils
import io.ktor.websocket.send
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.DelicateCoroutinesApi
Expand Down Expand Up @@ -30,11 +29,12 @@ class SubscriptionManager(val subscription: Subscription) {
15000
) {
Log.d("timer", "executed timer id: ${subscription.id}")
Log.d("timer", "isClosedForSend: ${subscription.connection.session.outgoing.isClosedForSend}")
currentJob?.cancel()
val oneHour = 60 * 60
if ((TimeUtils.now() - subscription.initialTime) >= oneHour) {

if (subscription.connection.session.outgoing.isClosedForSend) {
timer.cancel()
Log.d("timer", "cancelling subscription after 1 hour id: ${subscription.id}")
Log.d("timer", "cancelling subscription isClosedForSend: ${subscription.id}")
return@schedule
}

Expand Down

0 comments on commit b78a463

Please sign in to comment.