Skip to content
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

Process incoming foreground messages while subscribing #2705

Merged
merged 3 commits into from
Aug 31, 2022

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Aug 31, 2022

Calling relay_chain_sync.subscribe_all(...).await might take a long time (as it waits for the runtime of the chain to have been downloaded), during which messages coming from the public API of the sync service just pile up and aren't answered.
This PR fixes this by answering messages while we wait for the subscription to happen.

The consequence is that a parachain initialization now finishes quickly, while before it was waiting for its relay chain initialization to finish.
It also means that we now properly clean up parachains if we remove them, even if their relay chain never downloads its runtime. Before, the clean up didn't happen because the clean up never happens before initialization is complete.

I'm not really happy with the code duplication here, and would perform a refactoring that moves local variables into a struct, and adds methods to that struct, similar to standalone.rs.

Copy link
Contributor

@mergify mergify bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automatically approving tomaka's pull requests. This auto-approval will be removed once more maintainers are active.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 31, 2022

twiggy diff report

Difference in .wasm size before and after this pull request.


 Delta Bytes │ Item
─────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
      +14675 ┊ smoldot_light::sync_service::parachain::start_parachain::{{closure}}::h8061ad0acae26644
      -13359 ┊ <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hd71ed9b59fff1e59
        -438 ┊ core::ptr::drop_in_place<core::future::from_generator::GenFuture<smoldot_light::sync_service::parachain::start_parachain<smoldot_light_wasm::platform::Platform>::{{closure}}>>::h8f9ceeff87e013f0
        +438 ┊ core::ptr::drop_in_place<core::future::from_generator::GenFuture<smoldot_light::sync_service::parachain::start_parachain<smoldot_light_wasm::platform::Platform>::{{closure}}>>::hac18bc409a8df5c0
        +402 ┊ core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut::h305b9a50768ad49b
        -402 ┊ core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut::h9d82817830bade80
        -392 ┊ itertools::Itertools::join::h012c3b637f14ff2b
        -392 ┊ itertools::Itertools::join::h04050778a178e584
        -392 ┊ itertools::Itertools::join::h359d21405d4c8abf
        +392 ┊ itertools::Itertools::join::h4c8141177e0d3245
        +392 ┊ itertools::Itertools::join::h6115c78fa4ead132
        +392 ┊ itertools::Itertools::join::hc5bc1b70b523b48d
        -376 ┊ <futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll::h549c667bade04da5
        +376 ┊ <futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll::haa64cf9c3e72464d
        +283 ┊ <futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll::h9bded82f4b1d9b32
        -270 ┊ <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter::h8a50b8701d2c5745
        +270 ┊ <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter::ha79d8df8a2479650
        +270 ┊ <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter::hf0b711e0b28d8239
        -259 ┊ <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter::h47c114ba723148ca
        +259 ┊ <alloc::vec::Vec<T> as alloc::vec::spec_from_iter_nested::SpecFromIterNested<T,I>>::from_iter::hd7049b7d9f6bc15f
       +3156 ┊ ... and 209 more.
       +9663 ┊ Σ [229 Total Rows]

@tomaka tomaka added the automerge Automatically merge pull request as soon as possible label Aug 31, 2022
@mergify mergify bot merged commit ce720cc into paritytech:main Aug 31, 2022
@tomaka tomaka deleted the paralellize-para-task branch August 31, 2022 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Automatically merge pull request as soon as possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants