As in this?
Is that done externally, e.g. with Python subprocess (which is what I used for my timeout kill tester)?
Feature Request: Time Limit for Compaction also asks for this. I also found one GitHub issue asking
[Feature request] Show progress during compaction #3397
Did you see any other change requests or useful discussions beyond my cited 2 in forum and 1 issue?
If low threshold causes churn and high threshold wastes storage, maybe an efficient way to compact under a time limit using the current algorithm (which applies the threshold to both total and volumes) would be to compact volumes in something like descending order of space wasted in specific volume.
Under a changed algorithm which looks only at volume waste, this would be sort of a natural outcome.