console: fold releaseDomainHostHeld back into releaseDomainHost
Only purge called it with record false; with the purge release gone it has one caller.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+5
−13
internal/console/domainattach.go+5 −13
diff --git a/internal/console/domainattach.go b/internal/console/domainattach.go| index 1ccebd126..eff9f536e 100644 |
| --- a/internal/console/domainattach.go |
| +++ b/internal/console/domainattach.go |
| @@ -431,8 +431,9 @@ func domainNotAttached() *doorRefusal { |
| // first-route record behind it (if any) and then the claim, announcing the |
| // change. Anything else (no claim, another account's or another app's) is |
| // the 404 refusal, with nothing touched. A finished purchase whose app has |
| -// gone releases its hosts through it too (finishPurchaseUnpointed). host is |
| -// already normalized. |
| +// gone releases its hosts through it too (finishPurchaseUnpointed), and so |
| +// does pointing a bought domain over a purged app's claim |
| +// (takeOverPurgedClaim). host is already normalized. |
| func (s *Server) releaseDomainHost(ctx context.Context, acct *Account, app, host, principal string) *doorRefusal { |
| if lifetimesUnit(ctx) { |
| // Admitted on: the claim read, the record and the claim release |
| @@ -440,15 +441,6 @@ func (s *Server) releaseDomainHost(ctx context.Context, acct *Account, app, host |
| // every attach of the hostname holds from its claim to its record. |
| defer s.lockAppHost(acct.Sqid, app, host)() |
| } |
| - return s.releaseDomainHostHeld(ctx, acct, app, host, principal, true) |
| -} |
| - |
| -// releaseDomainHostHeld is releaseDomainHost inside the locks it takes |
| -// (admitted on, the caller holds s.lockApp and host's exclusion). record |
| -// false skips the first-route record step: the purge with lifetimes has |
| -// already retired every record of the app, and an instance catch-all has |
| -// none. |
| -func (s *Server) releaseDomainHostHeld(ctx context.Context, acct *Account, app, host, principal string, record bool) *doorRefusal { |
| notAttached := domainNotAttached() |
| claim, err := domains.GetClaim(ctx, s.cfg.Releases, host) |
| if err != nil { |
| @@ -462,10 +454,10 @@ func (s *Server) releaseDomainHostHeld(ctx context.Context, acct *Account, app, |
| if claim.Account != acct.Sqid || claim.App != app { |
| return notAttached |
| } |
| - firstRoute := record && claim.Route == "" |
| + firstRoute := claim.Route == "" |
| if firstRoute && lifetimesUnit(ctx) { |
| // First-route, admitted on: the record retires through its |
| - // tombstone inside the two locks the caller holds, before the claim. |
| + // tombstone inside the two locks held above, before the claim. |
| ref, err := s.detachRetireLocked(ctx, acct.Sqid, app, host) |
| if err != nil { |
| log.Printf("console: detach %s: record delete: %v", host, err) |