fix(static-file): run producer only if passed non-empty targets (#7424)

This commit is contained in:
Alexey Shekhirin
2024-04-02 18:59:38 +02:00
committed by GitHub
parent 112c8a3f1e
commit b653b3de15

View File

@ -124,6 +124,11 @@ impl<DB: Database> StaticFileProducerInner<DB> {
/// NOTE: it doesn't delete the data from database, and the actual deleting (aka pruning) logic /// NOTE: it doesn't delete the data from database, and the actual deleting (aka pruning) logic
/// lives in the `prune` crate. /// lives in the `prune` crate.
pub fn run(&mut self, targets: StaticFileTargets) -> StaticFileProducerResult { pub fn run(&mut self, targets: StaticFileTargets) -> StaticFileProducerResult {
// If there are no targets, do not produce any static files and return early
if !targets.any() {
return Ok(targets)
}
debug_assert!(targets.is_contiguous_to_highest_static_files( debug_assert!(targets.is_contiguous_to_highest_static_files(
self.static_file_provider.get_highest_static_files() self.static_file_provider.get_highest_static_files()
)); ));