Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ExecutionContexts as a parameter to MapDb.
* Add ExecutionContexts as a parameter to MapDb. For use with ScalaTest's SerialExecutionContext - to make test order more deterministic. Defined a new `ComputeAndBlockingExecutionContext` interface to pass in to MapDb, made QuineDistpacthes a subclass of that, and then added a test-only `FromSingleExecutionContext` impl that uses the same ExecutionContext for both. Used in MapDbPersistorSpec. MapDbPersistorTests times out if I try to use SerialExecutionContext - maybe it's blocking some threads or otherwise relies on multithreading? * Use SerialExecutionContext in RocksDbPersistorSpec too * Switched MapDb and RocksDb to use parasitic ExecutionContext in tests scalatest/scalatest#2314 (comment) * Also convert HistoricalQueryTests to use parasitic ExecutionContext GitOrigin-RevId: d83efbcd7126be0a2ad9f6294a03ab52a5e1c54c
- Loading branch information
1 parent
377e9fd
commit 93ec7fa
Showing
9 changed files
with
58 additions
and
22 deletions.
There are no files selected for viewing
11 changes: 9 additions & 2 deletions
11
quine-core/src/main/scala/com/thatdot/quine/util/QuineDispatchers.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
quine-core/src/test/scala/com/thatdot/quine/util/FromSingleExecutionContext.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.thatdot.quine.util | ||
|
||
import scala.concurrent.ExecutionContext | ||
|
||
/** Use the same EC for both of them. Intended for use with ScalaTest's SerialExecutionContext | ||
* @param executionContext | ||
*/ | ||
class FromSingleExecutionContext(executionContext: ExecutionContext) extends ComputeAndBlockingExecutionContexts { | ||
|
||
val nodeDispatcherEC: ExecutionContext = executionContext | ||
|
||
val blockingDispatcherEC: ExecutionContext = executionContext | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters