Azure / Azure/unbounded

Gantry: 10 - Lifecycle-bound background work

Open
#286 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
28
Forks
11
Avg merge
1d 8h
Merged PRs (30d)
55

Description

## Scope

Bind best-effort background work to agent lifecycle.

## Problem

`firePrefetch` and `reAdvertiseDigest` start goroutines with `context.Background()`, so shutdown cannot cancel them and manifest bursts can create unbounded concurrent best-effort work.

Evidence:

- `internal/gantry/mirror/mirror.go:1756`
- `internal/gantry/mirror/mirror.go:1774`

## Changes

- Pass an agent-scoped context or a cancellable child into `firePrefetch` and `reAdvertiseDigest` instead of `context.Background()`.
- Add a small semaphore if manifest bursts create too many concurrent goroutines.
- Ensure shutdown cancellation stops these best-effort goroutines before discovery/libp2p teardown completes.

## Tests

- Lifecycle cancellation stops prefetch and readvertise goroutines.
- Shutdown does not start new background prefetch/readvertise work after drain begins.

Contributor guide

Open the contributing guide

Research direction

Start in internal/gantry/mirror/mirror.go at lines 1756 and 1774, tracing firePrefetch and reAdvertiseDigest through the agent lifecycle and shutdown path. Run or add lifecycle tests covering cancellation and shutdown drain behavior; done means both goroutine types stop on cancellation and no new work starts after drain begins.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.