This repository has been archived by the owner on Oct 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 67
chore: fuel-indexer: refactor run, service, and executor to take advantage of tokio::task::JoinSet #1327
Merged
Conversation
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
lostman
force-pushed
the
maciej/joinset
branch
2 times, most recently
from
September 4, 2023 14:18
79b48bc
to
b0d8e1d
Compare
lostman
force-pushed
the
maciej/joinset
branch
from
September 4, 2023 14:36
b0d8e1d
to
254fe98
Compare
lostman
force-pushed
the
maciej/joinset
branch
from
September 4, 2023 17:37
37a2f2b
to
d97ccbc
Compare
lostman
force-pushed
the
maciej/joinset
branch
from
September 5, 2023 09:21
9de6b61
to
87ee703
Compare
deekerno
suggested changes
Sep 11, 2023
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 looks pretty good! I like the cleanup. I left a few comments to be addressed before approval.
deekerno
approved these changes
Sep 12, 2023
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.
🆗
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR cleans up parts of
IndexerService
,Executor
, andfuel-indexer
'srun.rs
.There is a slight change of semantics due to the replacement of
FuturesUnordered
withJoinSet
:JoinSet
aborts all tasks when it is dropped. This appeared inweb-api
tests that dropped theIndexerService
object before the tests' completion. Tasks added toFuturesUnordered
would've been running anyway (sincetask::spawn
detaches the future). Tasks spawned into the task set ofIndexerService
are aborted. This required a small change to the tests to keep theIndexerService
alive.Testing steps
CI tests should pass.
Changelog
FuturesUnordered
withtokio::task::JoinSet
service.rs
andexecutor.rs
: move the kill switch intoExecutor
implementations and expose through the trait interface; expose the manifest the same way. This allows cleaning up some functions that now only need the executor and no other parameters.run.rs
to use theJoinSet
for all subsystems (node, web-api, signal-handler, etc.).WasmIndexExecutor::new()
takes WASM bytes and notExecSource
: we were passingExecSource::Manifest
and returningExecSource::Registry(wasm_bytes)
. Instead, the WASM bytes are loaded beforenew()
is called, and everything is simpler this way.IndexerService::run
removes completed tasks from theJoinSet
and runs the service loop:loop { tokio::select! ... }
. This way, we don't need two separate tasks for it.Measuring resource usage:
Changes in this PR have no adverse effect on the resource usage: