mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-06-10 13:30:49 +00:00
Fix goroutine leak in POST webhook handler.
In Go, unsized channels are unbuffered and require the sender and the receiver to rendezvous, or the sender blocks. If the receiver never listens the sender cannot know this. In Rust, unsized channels have an unbounded buffer and sending into a channel with no receiver returns an error. I got confused by the difference in semantics. V12-Ref: F-77239
This commit is contained in:
+1
-1
@@ -868,7 +868,7 @@ func postPage(w http.ResponseWriter, r *http.Request) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
resultChan := make(chan UpdateResult)
|
||||
resultChan := make(chan UpdateResult, 1)
|
||||
go func(ctx context.Context) {
|
||||
ctx, cancel := context.WithTimeout(ctx, time.Duration(config.Limits.UpdateTimeout))
|
||||
defer cancel()
|
||||
|
||||
Reference in New Issue
Block a user