code: function findInsertionPosition(queue, update) {
    var priorityLevel = update.priorityLevel;
    var insertAfter = null;
    var insertBefore = null;
    if (queue.last !== null && comparePriority(queue.last.priorityLevel, priorityLevel) <= 0) {
      // Fast path for the common case where the update should be inserted at
      // the end of the queue.
      insertAfter = queue.last;
    } else {
      insertBefore = queue.first;
      while (insertBefore !== null && comparePriority(insertBefore.priorityLevel, priorityLevel) <= 0) {
        insertAfter = insertBefore;
        insertBefore = insertBefore.next;
      }
    }
    return insertAfter;
  }
docs: Returns the update after which the incoming update should be inserted into the queue, or null if it should be inserted at beginning.