[PR #6139] [MERGED] fix(sub): coalesce external subscription refreshes #6102

Closed
opened 2026-11-02 04:06:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6139
Author: @PathGao
Created: 7/29/2026
Status: ✅ Merged
Merged: 7/29/2026
Merged by: @MHSanaei

Base: main ← Head: fix-subscription-cache-refresh


📝 Commits (2)

  • 5a4aee4 fix(sub): coalesce external subscription refreshes
  • 021e9cd fix(sub): preserve shared stale refresh results

📊 Changes

2 files changed (+194 additions, -9 deletions)

View changed files

📝 internal/sub/external_subscription.go (+54 -9)
📝 internal/sub/external_subscription_test.go (+140 -0)

📄 Description

Summary

When a cached external subscription expired, simultaneous client requests each fetched the provider independently. Refreshes are now coalesced per URL; callers share the outcome, including the existing stale-on-error fallback.

The local cache is capped at 256 entries and removes the least recently fetched non-current entry when it fills.

Validation

  • make verify
  • go test -race -shuffle=on -count=1 ./internal/sub

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/6139 **Author:** [@PathGao](https://github.com/PathGao) **Created:** 7/29/2026 **Status:** ✅ Merged **Merged:** 7/29/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix-subscription-cache-refresh` --- ### 📝 Commits (2) - [`5a4aee4`](https://github.com/MHSanaei/3x-ui/commit/5a4aee49557aa36e92484bba59e5ca3c5e087f69) fix(sub): coalesce external subscription refreshes - [`021e9cd`](https://github.com/MHSanaei/3x-ui/commit/021e9cd6eb2cc239d73c7845c760be357a02e980) fix(sub): preserve shared stale refresh results ### 📊 Changes **2 files changed** (+194 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `internal/sub/external_subscription.go` (+54 -9) 📝 `internal/sub/external_subscription_test.go` (+140 -0) </details> ### 📄 Description ## Summary When a cached external subscription expired, simultaneous client requests each fetched the provider independently. Refreshes are now coalesced per URL; callers share the outcome, including the existing stale-on-error fallback. The local cache is capped at 256 entries and removes the least recently fetched non-current entry when it fills. ## Validation - `make verify` - `go test -race -shuffle=on -count=1 ./internal/sub` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:06:22 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#6102
No description provided.