Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def process(m: ProcessBatch): Future[List[Any]] = processTimer {
- if (m.actions.isEmpty) {
- EmptyDone
- } else {
- implicit val t: Timeout = m.timeout
- val f = for {
- tx ← Future {
- val GameCycleContext(gameCycleId, _, _) = GameCycleContext.requireContext(m.context)
- Tx(
- gameCycleId,
- m.actions,
- currentTime + m.timeout.toMillis,
- Tx.mkLocation(framework.cluster.selfUniqueAddress),
- SerializableContext(m.context)
- )
- }
- _ ← storage.persist(tx.key, tx)
- resp ← (self ? tx).mapTo[TxResponse]
- result ← (resp.txActor ? Transaction.Process).mapTo[List[Any]]
- confirmed ← resp.txActor ? Confirm
- } yield result
- f onFailure {
- case e: Throwable ⇒
- log(level = logger.Error, message = s"Error while processing transaction: $e", ex = e, ctx = m.context)
- }
- f
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment