tomusdrw / rust-web3

Ethereum JSON-RPC multi-transport client. Rust implementation of web3 library. ENS address: rust-web3.eth
MIT License
1.45k stars 471 forks source link

BaseFilters should be uninstalled on drop #583

Open marmistrz opened 2 years ago

marmistrz commented 2 years ago

This is not a trivial issue, because Rust doesn't support async drop at the moment. See https://internals.rust-lang.org/t/asynchronous-destructors/11127/26.

Meanwhile, I submitted a PR updating the docs: https://github.com/tomusdrw/rust-web3/pull/584

tomusdrw commented 2 years ago

Can't we spawn a background task to uninstall the filter? Or maybe we shall panic in case it wasn't uninstalled (or at least display an error), wdyt?

marmistrz commented 2 years ago

We definitely shouldn't panic. (At least some of the) JSON-RPC API providers might simply remove unused filters, so lack of removal won't be an issue for many applications.

We could spawn a background task but then the application can't react to any errors should they happen.