Skip to content

Commit

Permalink
proxy: fix the proxy using a ctx value with a cancel that it shouldn'…
Browse files Browse the repository at this point in the history
…t have
  • Loading branch information
Wessie committed Jan 2, 2025
1 parent c255a67 commit 57089e1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions proxy/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ func (srv *Server) SourceStream(ctx context.Context) (eventstream.Stream[radio.P
}

func (srv *Server) KickSource(ctx context.Context, id radio.SourceID) error {
// make the ctx not have a cancel, this is a very specific behavior to this API
// because it spins off a goroutine that also gets the ctx, but once we return
// from this function the ctx gets canceled and everything in said goroutine fails
//
// also this function call is basically non-reverseable so having it be cancelable by
// the ctx doesn't make sense.
ctx = context.WithoutCancel(ctx)
return srv.proxy.RemoveSourceClient(ctx, id)
}

Expand Down

0 comments on commit 57089e1

Please sign in to comment.