Copilot commented on code in PR #6906:
URL: https://github.com/apache/texera/pull/6906#discussion_r3651842396


##########
amber/src/main/python/core/util/customized_queue/linked_blocking_multi_queue.py:
##########
@@ -418,9 +418,12 @@ def add_sub_queue(self, key: K, priority: int) -> 
Optional[SubQueue]:
                         added = True
                         break
                     elif pg.priority > priority:
+                        # pg has a lower priority than the new group, so the 
new
+                        # group belongs in front of it: priority_groups must 
stay
+                        # sorted because the selection strategy walks it in 
order.
                         new_pg = 
LinkedBlockingMultiQueue.PriorityGroup(priority)
                         new_pg.add_queue(sub_queue)
-                        self.priority_groups.append(new_pg)
+                        self.priority_groups.insert(i, new_pg)

Review Comment:
   `PriorityGroup` is an `@inner` class; instantiating it via 
`LinkedBlockingMultiQueue.PriorityGroup(...)` does **not** bind `owner` to this 
queue instance (see `inner.py`: instance binding only happens via 
`self.PriorityGroup(...)`). Because `PriorityGroup.remove_queue` uses 
`self.owner.total_count`, creating groups this way can later raise 
`AttributeError` when a sub-queue/group is removed (owner remains the outer 
class, not the instance). Construct the group via `self.PriorityGroup(...)` in 
both places.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to