Skip to main content

prune_other_versions

Function prune_other_versions 

Source
pub fn prune_other_versions(sole_instance: &(dyn Fn() -> bool + Sync))
Expand description

Delete every staged bundle that is not this server’s own version.

Staging never removes an older directory - the server still running on it needs it - so the boot of the new server is the one moment that knows the old tree is finished with. Each is a CEF tree, so leaving them would grow the app-support dir by hundreds of megabytes per release.

sole_instance is asked again before every removal, not once at the boot: a peer on another config dir that takes its lock after the first check makes the tree shared again, and deleting its bundle is the mid-task loss this prune exists beside. A machine-wide lock every boot holds would close the window fully; this narrows it to the gap between the check and one remove_dir_all.