Maybe the setImmediate should be here. not inside the the rather graphically named asyncSortTimeouts().