gitea: clear every cached config when the owner's row changes
the config cache is keyed by user, but a member's entry holds the owner's base — resolved at read time, since a member's row stores no url. dropping only the caller's entry was correct while each row was self-contained; once rows inherit, the owner moving or disconnecting the instance left every member cached against the previous host until the sidecar restarted. also returns the resolved instanceUrl from connectionState. members not being able to set it is the invariant; not seeing it never was and could not be — every avatar_url the instance hands back is on that origin. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,18 @@ export function invalidateGiteaConfig(userId: number): void {
|
||||
cache.delete(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear every user's cached config.
|
||||
*
|
||||
* Needed because a member's entry holds the OWNER'S base, resolved at read time. Dropping only the
|
||||
* caller's entry was correct while each row was self-contained; once rows inherit, changing the instance
|
||||
* leaves every member cached against the previous host until this process restarts — pointing their
|
||||
* tokens at a server the owner has just moved away from. Call this whenever the owner's row changes.
|
||||
*/
|
||||
export function invalidateAllGiteaConfigs(): void {
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
// One Gitea instance, one token per person. The base comes from whoever owns the platform; the token is
|
||||
// this caller's own, so what they see is their account — their repos, their notifications, their issues.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user