Skip to content

BackgroundProcessor is not wasm-web compatible #1864

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

Closed
benthecarman opened this issue Nov 20, 2022 · 1 comment · Fixed by #1962
Closed

BackgroundProcessor is not wasm-web compatible #1864

benthecarman opened this issue Nov 20, 2022 · 1 comment · Fixed by #1962
Milestone

Comments

@benthecarman
Copy link
Contributor

Because BackgroundProcessor::start uses std::thread and std::time::Instant this function is unable to be called in a wasm runtime. It would be great if these were able to be abstracted out or a separate version that didn't require these was available so everything could be run in the browser.

For now our solution is just copy-pasting the define_run_body macro into our own code and seeing if we can get that to work. However, this is not the best alternative as we'd like to just use what rust-lightning has so we don't need to check if this macro has changed every time we update the dependency.

@TheBlueMatt
Copy link
Collaborator

I think we can make the futures feature version no-std compatible (insofar as the actual futures runtime can generate a future for a timer) by re-using the existing sleep-future-fetcher to do all the time checks. This would let JS folks spawn a JS timer and then pass it back through as a JsFuture (I think).

@TheBlueMatt TheBlueMatt added this to the 0.0.114 milestone Nov 21, 2022
TheBlueMatt added a commit to TheBlueMatt/rust-lightning that referenced this issue Jan 17, 2023
`background-processor` does a number of jobs on various timers.
Instead of doing those by interrogating `std::time::Instant`, this
change swaps to using the existing user-provided sleep future.

Fixes lightningdevkit#1864.
vss96 pushed a commit to vss96/rust-lightning that referenced this issue Mar 6, 2023
`background-processor` does a number of jobs on various timers.
Instead of doing those by interrogating `std::time::Instant`, this
change swaps to using the existing user-provided sleep future.

Fixes lightningdevkit#1864.
optout21 pushed a commit to optout21/rust-lightning that referenced this issue Jul 24, 2023
`background-processor` does a number of jobs on various timers.
Instead of doing those by interrogating `std::time::Instant`, this
change swaps to using the existing user-provided sleep future.

Fixes lightningdevkit#1864.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants