Skip to content

Sort provider pool members by priority then weight - #108

Merged
MasonXon merged 1 commit into
mainfrom
sort-pool-members-by-priority-weight
Aug 10, 2026
Merged

Sort provider pool members by priority then weight#108
MasonXon merged 1 commit into
mainfrom
sort-pool-members-by-priority-weight

Conversation

@MasonXon

@MasonXon MasonXon commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Why

The pool member list did not reflect the backend's actual call order, so users could not see which member would be tried first without opening each member's config.

The backend (orderedMembers() in provider_pool_inference.go) tries members in priority ascending order (lower priority first), and load-splits within the same priority by weight ratio.

What changed

sortProviderPoolMembers orders members by:

  1. priority ascending — matches the backend call order (lower is tried first)
  2. weight descending within the same priority — purely visual; within a priority there is no call order (members are load-split by weight ratio), but listing higher-weight members first matches the intuition that they carry more traffic.

Applied at three points so the list stays ordered during editing:

  • opening the edit dialog (openProviderPoolDialog)
  • after saving a member's config (saveProviderPoolMemberConfigDialog)
  • when adding a member (toggleProviderPoolSourceModel)

The saved pool list page (ProviderPoolsSection) also sorts and now shows priority/weight badges on each member card, so the order and routing are visible without opening the editor. The edit dialog member cards already show the same badges.

Notes

  • Weight tiebreaker is visual only — within a priority, members are equal; weight just sets the traffic split ratio.
  • Stable within the same (priority, weight) — preserves the user's relative order for ties.
image

The pool member list now reflects the backend's actual call order:
priority ascending (lower is tried first), then weight descending
within the same priority for visual grouping of higher-traffic members.

Applies in three places: when opening the edit dialog, after saving a
member's config, and when adding a member. The saved pool list page
also sorts and shows priority/weight badges so the order is visible
without opening the editor.
@ganisback
ganisback self-requested a review August 10, 2026 13:21
@MasonXon
MasonXon merged commit 42c0af1 into main Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants