Github user masaori335 commented on a diff in the pull request:
https://github.com/apache/trafficserver/pull/708#discussion_r67087190
--- Diff: lib/ts/PriorityQueue.h ---
@@ -115,6 +117,22 @@ PriorityQueue<T, Comp>::pop()
template <typename T, typename Comp>
void
+PriorityQueue<T, Comp>::erase(PriorityQueueEntry<T> *entry)
+{
+ if (empty()) {
+ return;
+ }
+
+ _v.remove_index(entry->index);
+
+ // Correct all of the indexes for the removed items
+ for (unsigned int idx = entry->index; idx < _v.length(); idx++) {
--- End diff --
IMO, we can avoid rewriting all of the indexes because this is Binary Heap.
How about this like what we're doing in `PriorityQueue<T, Comp>::pop()` ?
```
_v[entry->index] = _v[_v.length() - 1];
_v.pop();
_bubble_down(entry->index);
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---