This is an automated email from the ASF dual-hosted git repository.

toulmean pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git


The following commit(s) were added to refs/heads/main by this push:
     new c777f78  fix flaky test
     new 1a91a19  Merge pull request #356 from atoulme/fix_flaky_test2
c777f78 is described below

commit c777f78ea87729ae7397ffd3946b3fe6adac0431
Author: Antoine Toulme <[email protected]>
AuthorDate: Fri Jan 7 23:32:10 2022 -0800

    fix flaky test
---
 devp2p/src/main/kotlin/org/apache/tuweni/devp2p/DiscoveryService.kt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git 
a/devp2p/src/main/kotlin/org/apache/tuweni/devp2p/DiscoveryService.kt 
b/devp2p/src/main/kotlin/org/apache/tuweni/devp2p/DiscoveryService.kt
index c2d5891..dc6475f 100644
--- a/devp2p/src/main/kotlin/org/apache/tuweni/devp2p/DiscoveryService.kt
+++ b/devp2p/src/main/kotlin/org/apache/tuweni/devp2p/DiscoveryService.kt
@@ -23,10 +23,10 @@ import io.vertx.core.buffer.Buffer
 import io.vertx.core.datagram.DatagramPacket
 import io.vertx.core.net.SocketAddress
 import io.vertx.kotlin.coroutines.await
+import io.vertx.kotlin.coroutines.dispatcher
 import kotlinx.coroutines.CompletableDeferred
 import kotlinx.coroutines.CoroutineExceptionHandler
 import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.Dispatchers
 import kotlinx.coroutines.Job
 import kotlinx.coroutines.TimeoutCancellationException
 import kotlinx.coroutines.async
@@ -295,8 +295,7 @@ internal class CoroutineDiscoveryService constructor(
   private val routingTable: PeerRoutingTable = 
DevP2PPeerRoutingTable(keyPair.publicKey()),
   private val packetFilter: ((SECP256K1.PublicKey, SocketAddress) -> Boolean)? 
= null,
   private val timeSupplier: () -> Long = 
DiscoveryService.CURRENT_TIME_SUPPLIER,
-  private val job: Job = Job(),
-  override val coroutineContext: CoroutineContext = job + Dispatchers.Default 
+ CoroutineExceptionHandler { _, _ -> },
+  override val coroutineContext: CoroutineContext = vertx.dispatcher() + 
CoroutineExceptionHandler { _, _ -> },
 ) : DiscoveryService, CoroutineScope {
 
   companion object {

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to