4180a96 backend: re-think the worker-limit concept

Authored and Committed by praiskup 3 years ago
    backend: re-think the worker-limit concept
    
    Previously we held the statistics about running workers across all
    WorkerManager.run() calls.  Now we calculate statistics for each run()
    since the last WorkerManager.clean_tasks() call.
    
    This means that within one run(), when some prioritized task is skipped
    because of some limit, we skip other tasks that also approach the same
    limit.  The benefit is that tasks with lower priority never beat tasks
    with higher priority.  The consequence is that each released worker will
    be taken during the next run() soonest.
    
    Fixes: #1415