Skip to content

Commit 399730b

Browse files
author
Michał Mrożek
authored
[CHORE] Update akka (v2.6.9), akka http (v10.2.0) (#662)
1 parent 6477581 commit 399730b

File tree

22 files changed

+78
-111
lines changed

22 files changed

+78
-111
lines changed

build.sbt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,20 @@ val commonSettings = Seq(
1111
resolvers += "rocksDb" at "https://dl.bintray.com/ethereum/maven/"
1212

1313
val dep = {
14-
val akkaVersion = "2.5.12"
15-
val akkaHttpVersion = "10.1.1"
14+
val akkaVersion = "2.6.9"
15+
val akkaHttpVersion = "10.2.0"
1616
val circeVersion = "0.9.3"
1717
val rocksDb = "5.9.2"
1818

1919
Seq(
2020
"com.typesafe.akka" %% "akka-actor" % akkaVersion,
2121
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion,
2222
"com.typesafe.akka" %% "akka-testkit" % akkaVersion,
23+
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
2324
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
24-
"ch.megard" %% "akka-http-cors" % "0.3.0",
25+
"ch.megard" %% "akka-http-cors" % "1.1.0",
2526
"org.json4s" %% "json4s-native" % "3.5.4",
26-
"de.heikoseeberger" %% "akka-http-json4s" % "1.21.0",
27+
"de.heikoseeberger" %% "akka-http-json4s" % "1.34.0",
2728
"com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion % "it,test",
2829
"io.suzaku" %% "boopickle" % "1.3.0",
2930
"org.ethereum" % "rocksdbjni" % rocksDb,
@@ -37,9 +38,8 @@ val dep = {
3738
"io.circe" %% "circe-generic" % circeVersion,
3839
"io.circe" %% "circe-parser" % circeVersion,
3940
"io.circe" %% "circe-generic-extras" % circeVersion,
40-
"com.miguno.akka" %% "akka-mock-scheduler" % "0.5.1" % "it,test",
41+
"com.miguno.akka" %% "akka-mock-scheduler" % "0.5.5" % "it,test",
4142
"commons-io" % "commons-io" % "2.6",
42-
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
4343
"org.scala-sbt.ipcsocket" % "ipcsocket" % "1.0.0",
4444
"org.bouncycastle" % "bcprov-jdk15on" % "1.59",
4545
"com.typesafe.scala-logging" %% "scala-logging" % "3.9.0",
@@ -50,7 +50,6 @@ val dep = {
5050
// mallet deps
5151
"org.jline" % "jline" % "3.1.2",
5252
"net.java.dev.jna" % "jna" % "4.5.1",
53-
"org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.5",
5453
"com.github.scopt" %% "scopt" % "3.7.0",
5554

5655
// Metrics (https://github.com/DataDog/java-dogstatsd-client)

src/it/scala/io/iohk/ethereum/txExecTest/util/DumpChainActor.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,9 @@ class DumpChainActor(peerManager: ActorRef, peerMessageBus: ActorRef, startBlock
6262
}
6363

6464
//Periodically try to connect to bootstrap peer in case the connection failed before dump termination
65-
val connectToBootstrapTimeout: Cancellable = context.system.scheduler.schedule(0 seconds, 4 seconds, () =>
66-
peerManager ! PeerManagerActor.ConnectToPeer(new URI(bootstrapNode)))
65+
val connectToBootstrapTimeout: Cancellable = context.system.scheduler.scheduleWithFixedDelay(0 seconds, 4 seconds, peerManager, PeerManagerActor.ConnectToPeer(new URI(bootstrapNode)))
6766

68-
val assignWorkTimeout: Cancellable = context.system.scheduler.schedule(0 seconds, 2 seconds, () => assignWork())
67+
val assignWorkTimeout: Cancellable = context.system.scheduler.scheduleWithFixedDelay(0 seconds, 2 seconds)(() => assignWork())
6968

7069
// scalastyle:off
7170
override def receive: Receive = {

src/main/scala/io/iohk/ethereum/blockchain/sync/FastSync.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ class FastSync(
117117

118118
//Delay before starting to persist snapshot. It should be 0, as the presence of it marks that fast sync was started
119119
private val persistStateSnapshotDelay: FiniteDuration = 0.seconds
120-
private val syncStatePersistCancellable = scheduler.schedule(persistStateSnapshotDelay, persistStateSnapshotInterval, self, PersistSyncState)
121-
private val printStatusCancellable = scheduler.schedule(printStatusInterval, printStatusInterval, self, PrintStatus)
122-
private val heartBeat = scheduler.schedule(syncRetryInterval, syncRetryInterval * 2, self, ProcessSyncing)
120+
private val syncStatePersistCancellable = scheduler.scheduleWithFixedDelay(persistStateSnapshotDelay, persistStateSnapshotInterval, self, PersistSyncState)
121+
private val printStatusCancellable = scheduler.scheduleWithFixedDelay(printStatusInterval, printStatusInterval, self, PrintStatus)
122+
private val heartBeat = scheduler.scheduleWithFixedDelay(syncRetryInterval, syncRetryInterval * 2, self, ProcessSyncing)
123123

124124
def receive: Receive = handleCommonMessages orElse {
125125
case UpdateTargetBlock(state) => updateTargetBlock(state)

src/main/scala/io/iohk/ethereum/blockchain/sync/PeerListSupport.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ trait PeerListSupport {
2222

2323
var handshakedPeers: PeersMap = Map.empty
2424

25-
scheduler.schedule(0.seconds, syncConfig.peersScanInterval, etcPeerManager, EtcPeerManagerActor.GetHandshakedPeers)(global, context.self)
25+
scheduler.scheduleWithFixedDelay(0.seconds, syncConfig.peersScanInterval, etcPeerManager, EtcPeerManagerActor.GetHandshakedPeers)(global, context.self)
2626

2727
def removePeer(peerId: PeerId): Unit = {
2828
peerEventBus ! Unsubscribe(PeerDisconnectedClassifier(PeerSelector.WithId(peerId)))

src/main/scala/io/iohk/ethereum/blockchain/sync/PeersClient.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PeersClient(
2525
implicit val ec: ExecutionContext = context.dispatcher
2626

2727
val statusSchedule: Cancellable =
28-
scheduler.schedule(syncConfig.printStatusInterval, syncConfig.printStatusInterval, self, PrintStatus)
28+
scheduler.scheduleWithFixedDelay(syncConfig.printStatusInterval, syncConfig.printStatusInterval, self, PrintStatus)
2929

3030
def receive: Receive = running(Map())
3131

src/main/scala/io/iohk/ethereum/blockchain/sync/regular/OldRegularSync.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class OldRegularSync(
4343
import OldRegularSync._
4444
import syncConfig._
4545

46-
scheduler.schedule(printStatusInterval, printStatusInterval, self, PrintStatus)(global)
46+
scheduler.scheduleWithFixedDelay(printStatusInterval, printStatusInterval, self, PrintStatus)(global)
4747

4848
peerEventBus ! Subscribe(MessageClassifier(Set(NewBlock.code, NewBlockHashes.code), PeerSelector.AllPeers))
4949

src/main/scala/io/iohk/ethereum/blockchain/sync/regular/RegularSync.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ class RegularSync(
3131
"block-importer")
3232

3333
val printFetcherSchedule: Cancellable =
34-
scheduler.schedule(syncConfig.printStatusInterval, syncConfig.printStatusInterval, fetcher, BlockFetcher.PrintStatus)(context.dispatcher)
34+
scheduler.scheduleWithFixedDelay(syncConfig.printStatusInterval, syncConfig.printStatusInterval, fetcher, BlockFetcher.PrintStatus)(context.dispatcher)
3535
val printImporterSchedule: Cancellable =
36-
scheduler.schedule(syncConfig.printStatusInterval, syncConfig.printStatusInterval, importer, BlockImporter.PrintStatus)(context.dispatcher)
36+
scheduler.scheduleWithFixedDelay(syncConfig.printStatusInterval, syncConfig.printStatusInterval, importer, BlockImporter.PrintStatus)(context.dispatcher)
3737

3838
override def receive: Receive = {
3939
case Start =>

src/main/scala/io/iohk/ethereum/extvm/ExtVMInterface.scala

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
package io.iohk.ethereum.extvm
22

3-
import java.nio.ByteOrder
4-
53
import akka.actor.ActorSystem
6-
import akka.stream.{ActorMaterializer, OverflowStrategy}
4+
import akka.stream.OverflowStrategy
75
import akka.stream.scaladsl.{Framing, Keep, Sink, SinkQueueWithCancel, Source, SourceQueueWithComplete, Tcp}
86
import akka.util.ByteString
97
import io.iohk.ethereum.ledger.{InMemoryWorldStateProxy, InMemoryWorldStateProxyStorage}
108
import io.iohk.ethereum.utils.{BlockchainConfig, VmConfig}
119
import io.iohk.ethereum.vm._
12-
10+
import java.nio.ByteOrder
1311
import scala.annotation.tailrec
1412
import scala.util.{Failure, Success, Try}
1513

1614
class ExtVMInterface(externaVmConfig: VmConfig.ExternalConfig, blockchainConfig: BlockchainConfig, testMode: Boolean)(implicit system: ActorSystem)
1715
extends VM[InMemoryWorldStateProxy, InMemoryWorldStateProxyStorage]{
1816

19-
private implicit val materializer = ActorMaterializer()
20-
2117
private var out: Option[SourceQueueWithComplete[ByteString]] = None
2218

2319
private var in: Option[SinkQueueWithCancel[ByteString]] = None

src/main/scala/io/iohk/ethereum/extvm/VMServer.scala

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
11
package io.iohk.ethereum.extvm
22

3-
import java.nio.ByteOrder
4-
53
import akka.NotUsed
64
import akka.actor.ActorSystem
5+
import akka.stream.OverflowStrategy
76
import akka.stream.scaladsl.{Flow, Framing, Keep, Sink, Source, Tcp}
8-
import akka.stream.{ActorMaterializer, OverflowStrategy}
97
import akka.util.ByteString
108
import com.google.protobuf.{ByteString => GByteString}
119
import com.typesafe.config.ConfigFactory
1210
import io.iohk.ethereum.domain.{Address, BlockHeader}
1311
import io.iohk.ethereum.extvm.Implicits._
1412
import io.iohk.ethereum.utils._
15-
import io.iohk.ethereum.vm._
16-
import io.iohk.ethereum.vm.BlockchainConfigForEvm
17-
import io.iohk.ethereum.vm.ProgramResult
18-
13+
import io.iohk.ethereum.vm.{BlockchainConfigForEvm, ProgramResult, _}
14+
import java.nio.ByteOrder
1915
import scala.annotation.tailrec
2016
import scala.util.{Failure, Success, Try}
2117

2218
object VmServerApp extends Logger {
2319

2420
implicit val system = ActorSystem("EVM_System")
25-
implicit val materializer = ActorMaterializer()
2621

2722
def main(args: Array[String]): Unit = {
2823
val config = ConfigFactory.load()

src/main/scala/io/iohk/ethereum/faucet/Faucet.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import java.security.SecureRandom
44

55
import akka.actor.ActorSystem
66
import akka.http.scaladsl.Http
7-
import akka.stream.ActorMaterializer
87
import com.typesafe.config.ConfigFactory
98
import io.iohk.ethereum.keystore.KeyStoreImpl
109
import io.iohk.ethereum.mallet.service.RpcClient
@@ -19,13 +18,12 @@ object Faucet extends Logger {
1918
val config = FaucetConfig(ConfigFactory.load())
2019

2120
implicit val system = ActorSystem("Faucet-system")
22-
implicit val materializer = ActorMaterializer()
2321

2422
val keyStore = new KeyStoreImpl(KeyStoreConfig.customKeyStoreConfig(config.keyStoreDir), new SecureRandom())
2523
val rpcClient = new RpcClient(config.rpcAddress)
2624
val api = new FaucetApi(rpcClient, keyStore, config)
2725

28-
val bindingResultF = Http().bindAndHandle(api.route, config.listenInterface, config.listenPort)
26+
val bindingResultF = Http().newServerAt(config.listenInterface, config.listenPort).bind(api.route)
2927

3028
bindingResultF onComplete {
3129
case Success(serverBinding) => log.info(s"Faucet HTTP server listening on ${serverBinding.localAddress}")

src/main/scala/io/iohk/ethereum/faucet/FaucetConfig.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
package io.iohk.ethereum.faucet
22

3-
import akka.http.scaladsl.model.headers.HttpOriginRange
3+
import ch.megard.akka.http.cors.scaladsl.model.HttpOriginMatcher
44
import com.typesafe.config.{Config => TypesafeConfig}
55
import io.iohk.ethereum.domain.Address
66
import io.iohk.ethereum.utils.ConfigUtils
7-
87
import scala.concurrent.duration.{FiniteDuration, _}
98

109
case class FaucetConfig(
@@ -13,7 +12,7 @@ case class FaucetConfig(
1312
txGasPrice: BigInt,
1413
txGasLimit: BigInt,
1514
txValue: BigInt,
16-
corsAllowedOrigins: HttpOriginRange,
15+
corsAllowedOrigins: HttpOriginMatcher,
1716
rpcAddress: String,
1817
keyStoreDir: String,
1918
listenInterface: String,

src/main/scala/io/iohk/ethereum/jsonrpc/server/http/BasicJsonRpcHttpServer.scala

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ package io.iohk.ethereum.jsonrpc.server.http
22

33
import akka.actor.ActorSystem
44
import akka.http.scaladsl.Http
5-
import akka.http.scaladsl.model.headers.HttpOriginRange
6-
import akka.stream.ActorMaterializer
5+
import ch.megard.akka.http.cors.scaladsl.model.HttpOriginMatcher
76
import io.iohk.ethereum.jsonrpc._
87
import io.iohk.ethereum.jsonrpc.server.http.JsonRpcHttpServer.JsonRpcHttpServerConfig
98
import io.iohk.ethereum.utils.Logger
10-
119
import scala.concurrent.ExecutionContext.Implicits.global
1210
import scala.util.{Failure, Success}
1311

@@ -16,15 +14,13 @@ class BasicJsonRpcHttpServer(val jsonRpcController: JsonRpcController, config: J
1614
extends JsonRpcHttpServer with Logger {
1715

1816
def run(): Unit = {
19-
implicit val materializer = ActorMaterializer()
20-
21-
val bindingResultF = Http(actorSystem).bindAndHandle(route, config.interface, config.port)
17+
val bindingResultF = Http(actorSystem).newServerAt(config.interface, config.port).bind(route)
2218

2319
bindingResultF onComplete {
2420
case Success(serverBinding) => log.info(s"JSON RPC HTTP server listening on ${serverBinding.localAddress}")
2521
case Failure(ex) => log.error("Cannot start JSON HTTP RPC server", ex)
2622
}
2723
}
2824

29-
override def corsAllowedOrigins: HttpOriginRange = config.corsAllowedOrigins
25+
override def corsAllowedOrigins: HttpOriginMatcher = config.corsAllowedOrigins
3026
}

src/main/scala/io/iohk/ethereum/jsonrpc/server/http/JsonRpcHttpServer.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
package io.iohk.ethereum.jsonrpc.server.http
22

3-
import java.security.SecureRandom
4-
53
import akka.actor.ActorSystem
64
import akka.http.scaladsl.model.StatusCodes
7-
import akka.http.scaladsl.model.headers.HttpOriginRange
85
import akka.http.scaladsl.server.Directives._
96
import akka.http.scaladsl.server.{MalformedRequestContentRejection, RejectionHandler, Route}
107
import ch.megard.akka.http.cors.javadsl.CorsRejection
118
import ch.megard.akka.http.cors.scaladsl.CorsDirectives._
9+
import ch.megard.akka.http.cors.scaladsl.model.HttpOriginMatcher
1210
import ch.megard.akka.http.cors.scaladsl.settings.CorsSettings
1311
import de.heikoseeberger.akkahttpjson4s.Json4sSupport
1412
import io.iohk.ethereum.jsonrpc.{JsonRpcController, JsonRpcErrors, JsonRpcRequest, JsonRpcResponse}
1513
import io.iohk.ethereum.utils.{ConfigUtils, Logger}
14+
import java.security.SecureRandom
1615
import org.json4s.JsonAST.JInt
1716
import org.json4s.{DefaultFormats, native}
18-
1917
import scala.concurrent.ExecutionContext.Implicits.global
2018
import scala.concurrent.Future
2119
import scala.util.Try
@@ -27,7 +25,7 @@ trait JsonRpcHttpServer extends Json4sSupport {
2725

2826
implicit val formats = DefaultFormats
2927

30-
def corsAllowedOrigins: HttpOriginRange
28+
def corsAllowedOrigins: HttpOriginMatcher
3129

3230
val corsSettings = CorsSettings.defaultSettings
3331
.withAllowGenericHttpRequests(true)
@@ -84,7 +82,7 @@ object JsonRpcHttpServer extends Logger {
8482
val certificateKeyStorePath: Option[String]
8583
val certificateKeyStoreType: Option[String]
8684
val certificatePasswordFile: Option[String]
87-
val corsAllowedOrigins: HttpOriginRange
85+
val corsAllowedOrigins: HttpOriginMatcher
8886
}
8987

9088
object JsonRpcHttpServerConfig {

src/main/scala/io/iohk/ethereum/jsonrpc/server/http/JsonRpcHttpsServer.scala

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
package io.iohk.ethereum.jsonrpc.server.http
22

3-
import java.io.{File, FileInputStream}
4-
import java.security.{KeyStore, SecureRandom}
5-
import javax.net.ssl.{KeyManagerFactory, SSLContext, TrustManagerFactory}
6-
73
import akka.actor.ActorSystem
8-
import akka.http.scaladsl.model.headers.HttpOriginRange
94
import akka.http.scaladsl.{ConnectionContext, Http}
10-
import akka.stream.ActorMaterializer
5+
import ch.megard.akka.http.cors.scaladsl.model.HttpOriginMatcher
116
import io.iohk.ethereum.jsonrpc.JsonRpcController
127
import io.iohk.ethereum.jsonrpc.server.http.JsonRpcHttpServer.JsonRpcHttpServerConfig
138
import io.iohk.ethereum.jsonrpc.server.http.JsonRpcHttpsServer.HttpsSetupResult
149
import io.iohk.ethereum.utils.Logger
15-
10+
import java.io.{File, FileInputStream}
11+
import java.security.{KeyStore, SecureRandom}
12+
import javax.net.ssl.{KeyManagerFactory, SSLContext, TrustManagerFactory}
1613
import scala.concurrent.ExecutionContext.Implicits.global
1714
import scala.io.Source
1815
import scala.util.{Failure, Success, Try}
@@ -22,8 +19,6 @@ class JsonRpcHttpsServer(val jsonRpcController: JsonRpcController, config: JsonR
2219
extends JsonRpcHttpServer with Logger {
2320

2421
def run(): Unit = {
25-
implicit val materializer = ActorMaterializer()
26-
2722
val maybeSslContext = validateCertificateFiles(config.certificateKeyStorePath, config.certificateKeyStoreType, config.certificatePasswordFile).flatMap{
2823
case (keystorePath, keystoreType, passwordFile) =>
2924
val passwordReader = Source.fromFile(passwordFile)
@@ -35,12 +30,11 @@ class JsonRpcHttpsServer(val jsonRpcController: JsonRpcController, config: JsonR
3530
}
3631
}
3732

38-
val maybeHttpsContext = maybeSslContext.map(sslContext => ConnectionContext.https(sslContext))
33+
val maybeHttpsContext = maybeSslContext.map(sslContext => ConnectionContext.httpsServer(sslContext))
3934

4035
maybeHttpsContext match {
4136
case Right(httpsContext) =>
42-
Http().setDefaultServerHttpContext(httpsContext)
43-
val bindingResultF = Http().bindAndHandle(route, config.interface, config.port, connectionContext = httpsContext)
37+
val bindingResultF = Http().newServerAt(config.interface, config.port).enableHttps(httpsContext).bind(route)
4438

4539
bindingResultF onComplete {
4640
case Success(serverBinding) => log.info(s"JSON RPC HTTPS server listening on ${serverBinding.localAddress}")
@@ -113,7 +107,7 @@ class JsonRpcHttpsServer(val jsonRpcController: JsonRpcController, config: JsonR
113107
Left("HTTPS requires: certificate-keystore-path, certificate-keystore-type and certificate-password-file to be configured")
114108
}
115109

116-
override def corsAllowedOrigins: HttpOriginRange = config.corsAllowedOrigins
110+
override def corsAllowedOrigins: HttpOriginMatcher = config.corsAllowedOrigins
117111
}
118112

119113
object JsonRpcHttpsServer {

src/main/scala/io/iohk/ethereum/mallet/service/RpcClient.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import java.util.UUID
66
import akka.actor.ActorSystem
77
import akka.http.scaladsl.Http
88
import akka.http.scaladsl.model._
9-
import akka.stream.ActorMaterializer
109
import akka.util.ByteString
1110
import com.typesafe.config.ConfigFactory
1211
import io.circe.generic.auto._
@@ -32,7 +31,6 @@ object RpcClient {
3231
val akkaConfig = ConfigFactory.load("mallet")
3332

3433
implicit val system = ActorSystem("mallet_rpc", akkaConfig)
35-
implicit val mat = ActorMaterializer()
3634
implicit val ec = scala.concurrent.ExecutionContext.Implicits.global
3735

3836
new RpcClient(node)
@@ -43,7 +41,7 @@ object RpcClient {
4341
* Talks to a node over HTTP(S) JSON-RPC
4442
* Note: the URI schema determines whether HTTP or HTTPS is used
4543
*/
46-
class RpcClient(node: Uri)(implicit system: ActorSystem, mat: ActorMaterializer, ec: ExecutionContext) {
44+
class RpcClient(node: Uri)(implicit system: ActorSystem, ec: ExecutionContext) {
4745
import CommonJsonCodecs._
4846

4947
//TODO: CL option

src/main/scala/io/iohk/ethereum/network/KnownNodesManager.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class KnownNodesManager(
2525

2626
var toRemove: Set[URI] = Set.empty
2727

28-
scheduler.schedule(config.persistInterval, config.persistInterval, self, PersistChanges)
28+
scheduler.scheduleWithFixedDelay(config.persistInterval, config.persistInterval, self, PersistChanges)
2929

3030
override def receive: Receive = {
3131
case AddKnownNode(uri) =>

src/main/scala/io/iohk/ethereum/network/PeerManagerActor.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,12 @@ class PeerManagerActor(
5959
}
6060

6161
private def scheduleNodesUpdate(): Unit = {
62-
scheduler.schedule(peerConfiguration.updateNodesInitialDelay, peerConfiguration.updateNodesInterval){
63-
peerDiscoveryManager ! PeerDiscoveryManager.GetDiscoveredNodesInfo
64-
}
62+
scheduler.scheduleWithFixedDelay(
63+
peerConfiguration.updateNodesInitialDelay,
64+
peerConfiguration.updateNodesInterval,
65+
peerDiscoveryManager,
66+
PeerDiscoveryManager.GetDiscoveredNodesInfo
67+
)
6568
}
6669

6770
def listen(pendingPeers: PeerMap, peers: PeerMap): Receive = {

src/main/scala/io/iohk/ethereum/network/discovery/PeerDiscoveryManager.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class PeerDiscoveryManager(
3838

3939
if (discoveryConfig.discoveryEnabled) {
4040
discoveryListener ! DiscoveryListener.Subscribe
41-
context.system.scheduler.schedule(discoveryConfig.scanInitialDelay, discoveryConfig.scanInterval, self, Scan)
41+
context.system.scheduler.scheduleWithFixedDelay(discoveryConfig.scanInitialDelay, discoveryConfig.scanInterval, self, Scan)
4242
}
4343

4444
def scan(): Unit = {

0 commit comments

Comments
 (0)