Skip to content

fix(archiver): store and shut down API server during Stop()#57

Open
erhnysr wants to merge 1 commit into
base:masterfrom
erhnysr:fix/archiver-api-server-shutdown-v2
Open

fix(archiver): store and shut down API server during Stop()#57
erhnysr wants to merge 1 commit into
base:masterfrom
erhnysr:fix/archiver-api-server-shutdown-v2

Conversation

@erhnysr

@erhnysr erhnysr commented May 18, 2026

Copy link
Copy Markdown

Fixes #55

Problem

The HTTP API server started in Start() was stored only in a local variable and never assigned to the ArchiverService struct. As a result, Stop() had no reference to it and could not shut it down.

This could cause:

  • Port conflicts on restart
  • Leaked goroutines and sockets
  • Incomplete graceful shutdown

Fix

  • Added apiServer *httputil.HTTPServer field to ArchiverService
  • Assigned the server to the struct in Start()
  • Added apiServer.Stop(ctx) call in Stop()

This is consistent with how the standalone API service in api/service/service.go already handles shutdown.

Fixes base#55

The HTTP API server started in Start() was only stored in a local
variable and never assigned to the ArchiverService struct, so Stop()
could not shut it down.

Add an apiServer field to ArchiverService, assign it in Start(), and
call Stop(ctx) on it during service shutdown — consistent with how
the standalone API service in api/service/service.go handles shutdown.
@cb-heimdall

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@erhnysr

erhnysr commented Jun 21, 2026

Copy link
Copy Markdown
Author

Hi! Following up on this one too — fixes the API server not being stopped during Stop(), which can leave a dangling listener. Happy to rebase or adjust if needed.

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.

Archiver API server is not shut down during service stop

2 participants