-
Notifications
You must be signed in to change notification settings - Fork 75
[ETCM-454] Migrate Scala Futures to Monix Tasks #855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/ets/scala/io/iohk/ethereum/ets/blockchain/BlockchainSuite.scala
Outdated
Show resolved
Hide resolved
src/main/scala/io/iohk/ethereum/blockchain/sync/regular/BlockImporter.scala
Outdated
Show resolved
Hide resolved
@@ -110,7 +110,7 @@ class BlockImport( | |||
block: Block, | |||
currentBestBlock: Block, | |||
currentWeight: ChainWeight | |||
)(implicit blockExecutionContext: ExecutionContext): Future[BlockImportResult] = Future { | |||
)(implicit blockExecutionContext: ExecutionContext): Task[BlockImportResult] = Task.evalOnce { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this evalOnce
, or the ones above, needed? Isn't the task only evaluated once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought the same. But some tests fail if I just use Task.eval
, precisely because the mock expectations only expect 1 call. I would like to understand why in the tests this code is evaluated more than once, but this is the best I found for now.
src/main/scala/io/iohk/ethereum/blockchain/sync/regular/BlockImporter.scala
Outdated
Show resolved
Hide resolved
src/main/scala/io/iohk/ethereum/blockchain/sync/regular/BlockImporter.scala
Outdated
Show resolved
Hide resolved
src/test/scala/io/iohk/ethereum/blockchain/sync/regular/RegularSyncSpec.scala
Outdated
Show resolved
Hide resolved
src/test/scala/io/iohk/ethereum/blockchain/sync/regular/RegularSyncSpec.scala
Outdated
Show resolved
Hide resolved
src/test/scala/io/iohk/ethereum/blockchain/sync/regular/RegularSyncSpec.scala
Outdated
Show resolved
Hide resolved
src/test/scala/io/iohk/ethereum/consensus/BlockGeneratorSpec.scala
Outdated
Show resolved
Hide resolved
src/main/scala/io/iohk/ethereum/consensus/ethash/EthashBlockCreator.scala
Show resolved
Hide resolved
src/main/scala/io/iohk/ethereum/consensus/ethash/EthashConsensus.scala
Outdated
Show resolved
Hide resolved
src/main/scala/io/iohk/ethereum/consensus/ethash/TransactionPicker.scala
Outdated
Show resolved
Hide resolved
src/main/scala/io/iohk/ethereum/mallet/service/RpcClientMallet.scala
Outdated
Show resolved
Hide resolved
src/test/scala/io/iohk/ethereum/blockchain/sync/FastSyncSpec.scala
Outdated
Show resolved
Hide resolved
src/main/scala/io/iohk/ethereum/blockchain/sync/regular/BlockFetcher.scala
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎆
src/main/scala/io/iohk/ethereum/blockchain/sync/regular/BlockImporter.scala
Show resolved
Hide resolved
LGTM! |
Description
Changing a bunch of usages of Scala's
Future
to MonixTask
.Proposed Solution
Trying to keep everything in Monix
Tasks
and only convert toFuture
to execute them in the "edges" of the application.Important Changes Introduced
Testing