Refactor publish.py threading so that it's also throttled.