mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
Manual compaction endpoint backport (#7104)
Backports: - https://github.com/sigp/lighthouse/pull/7072 To: - https://github.com/sigp/lighthouse/issues/7039 #7103 should be merged first This PR introduces an endpoint that allows users to manually trigger background compaction.
This commit is contained in:
@@ -4105,6 +4105,23 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
},
|
||||
);
|
||||
|
||||
// POST lighthouse/compaction
|
||||
let post_lighthouse_compaction = warp::path("lighthouse")
|
||||
.and(warp::path("compaction"))
|
||||
.and(warp::path::end())
|
||||
.and(task_spawner_filter.clone())
|
||||
.and(chain_filter.clone())
|
||||
.then(
|
||||
|task_spawner: TaskSpawner<T::EthSpec>, chain: Arc<BeaconChain<T>>| {
|
||||
task_spawner.blocking_json_task(Priority::P0, move || {
|
||||
chain.manually_compact_database();
|
||||
Ok(api_types::GenericResponse::from(String::from(
|
||||
"Triggered manual compaction",
|
||||
)))
|
||||
})
|
||||
},
|
||||
);
|
||||
|
||||
// POST lighthouse/liveness
|
||||
let post_lighthouse_liveness = warp::path("lighthouse")
|
||||
.and(warp::path("liveness"))
|
||||
@@ -4878,6 +4895,7 @@ pub fn serve<T: BeaconChainTypes>(
|
||||
.uor(post_lighthouse_ui_validator_metrics)
|
||||
.uor(post_lighthouse_ui_validator_info)
|
||||
.uor(post_lighthouse_finalize)
|
||||
.uor(post_lighthouse_compaction)
|
||||
.recover(warp_utils::reject::handle_rejection),
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user