move queue size query befor sleep so we do not update many items we do not need to.  refs #9029