Skip to content

Commit

Permalink
server: implement RetryableFuture on XSNServiceRPCImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
iBlackShadow committed Sep 8, 2019
1 parent a549b74 commit 885c7d5
Show file tree
Hide file tree
Showing 6 changed files with 442 additions and 194 deletions.
5 changes: 5 additions & 0 deletions server/app/com/xsn/explorer/config/RetryConfig.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.xsn.explorer.config

import scala.concurrent.duration.FiniteDuration

case class RetryConfig(initialDelay: FiniteDuration, maxDelay: FiniteDuration)
8 changes: 8 additions & 0 deletions server/app/com/xsn/explorer/errors/xsnErrors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ case object XSNWorkQueueDepthExceeded extends XSNServerError {
List(error)
}
}

case object XSNWarmingUp extends XSNServerError {
override def toPublicErrorList[L](i18nService: I18nService[L])(implicit lang: L): List[PublicError] = {
val message = i18nService.render("xsn.server.unexpectedError")
val error = GenericPublicError(message)
List(error)
}
}
22 changes: 22 additions & 0 deletions server/app/com/xsn/explorer/modules/RetryableFutureModule.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.xsn.explorer.modules

import akka.actor.{ActorSystem, Scheduler}
import com.google.inject.{AbstractModule, Provides}
import com.xsn.explorer.config.RetryConfig

import scala.concurrent.duration._

class RetryableFutureModule extends AbstractModule {

override def configure(): Unit = {}

@Provides
def retryConfig(): RetryConfig = {
RetryConfig(1.second, 65.seconds)
}

@Provides
def scheduler(actorSystem: ActorSystem): Scheduler = {
actorSystem.scheduler
}
}
Loading

0 comments on commit 885c7d5

Please sign in to comment.