-
Notifications
You must be signed in to change notification settings - Fork 0
chore(cache): move cache system out of config #118
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
This stack of pull requests is managed by Graphite. Learn more about stacking. |
tests/cache.rs
Outdated
@@ -10,7 +13,7 @@ async fn test_bundle_poller_roundtrip() -> eyre::Result<()> { | |||
let config = setup_test_config().unwrap(); | |||
|
|||
let (block_env, _jh) = config.env_task().spawn(); | |||
let cache = config.spawn_cache_system(block_env); | |||
let cache = CacheSystem::spawn(&config, block_env); |
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.
this API doesn't match our idiom. our idiom is to
- instantiate a struct
let my_struct = MyStruct::new(...)
- call
my_struct.spawn()
CacheSystem
is not a spawnable task in this way, it;s only a holder for the join handles and a ref to the simcache to ensure it is not prematurely dropped
if you want to make a spawnable CacheTasks
then it should be a composition of the 2 component tasks that spawns both of them
struct CacheTask {
/// The transaction poller task.
pub tx: TxPoller,
/// The bundle poller task.
pub bundle: BundlePoller
}
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.
NACK on the new api. suggested an improvement that's in our idiom.
d06ffc0
to
6575e67
Compare
e31d791
to
b30b12a
Compare
6575e67
to
7bd7fdd
Compare
Note that this is not a new api—this was just moved from the config file. I'll update to the newly proposed API |
it's not new logic, it is a new API |
There's no reason for this to be contained here, and feels wrong when every other task has its own file / spawn pattern.
7bd7fdd
to
f506945
Compare
There's no reason for this to be contained here, and feels wrong when every other task has its own file / spawn pattern.