Allow get_persistence_condvar_value
outside of tests
#1661
Closed
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.
Summary
Allow usage of
ChannelManager::get_persistence_condvar_value
outside of tests.Motivation
Polling
We implemented a Tokio-based background processor that runs entirely in a single task and which doesn't need its own thread. Accordingly, we made our entire node single-threaded. However, the only exposed methods for determining whether a
ChannelManager
has a persistable update require blocking (await_persistable_update
,await_persistable_update_timeout
), and the only way to simulate 'polling' is to do something like the following:Which is really just a jank way of doing what we really want: to inspect the value inside the persistence condvar. This PR removes the
cfg
s onget_persistence_condvar_value
and allows us to poll for persistence updates in a completely non-blocking manner.Performance
This impacts performance too: with a polling frequency of 100ms (the default in rust-lightning background processor) and a poll timeout of 10ms, using
await_persistable_update_timeout
as above causes our single-threaded node to be blocked and unable to do anything else about 10% of the time.