When broadcasting privately, avoids keeping the connection open for other activities.

This commit is contained in:
Vitor Pamplona
2024-06-05 08:33:11 -04:00
parent ae418f9d45
commit d9cffa87ef
2 changed files with 3 additions and 2 deletions
@@ -165,7 +165,7 @@ object Client : RelayPool.Listener {
checkNotInMainThread()
relayList.forEach { relayUrl ->
RelayPool.getOrCreateRelay(relayUrl, setOf(FeedType.PRIVATE_DMS), { }) {
RelayPool.getOrCreateRelay(relayUrl, emptySet(), { }) {
it.sendOverride(signedEvent)
}
}
@@ -91,6 +91,7 @@ object RelayPool : Relay.Listener {
feedTypes: Set<FeedType>?,
onConnected: (Relay) -> Unit,
onDone: (() -> Unit)?,
timeout: Long = 60000,
) {
val relay = Relay(url, true, true, feedTypes ?: emptySet())
addRelay(relay)
@@ -103,7 +104,7 @@ object RelayPool : Relay.Listener {
onConnected(relay)
GlobalScope.launch(Dispatchers.IO) {
delay(60000) // waits for a reply
delay(timeout) // waits for a reply
relay.disconnect()
removeRelay(relay)