Skip to content

Commit

Permalink
Fix case where if timeout was too long the context would be canceled
Browse files Browse the repository at this point in the history
  • Loading branch information
germanoeich committed Dec 6, 2022
1 parent 3b97175 commit 3a912d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
10 changes: 6 additions & 4 deletions lib/bucketpath_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package lib

import (
"fmt"
"testing"
"fmt"
"testing"
)

func TestPaths(t *testing.T) {
Expand Down Expand Up @@ -39,7 +39,9 @@ func TestPaths(t *testing.T) {
{"/api/interactions/203039963636301824/aW50ZXJhY3Rpb246ODg3NTU5MDA01AY4NTUxNDU0OnZwS3QycDhvREk2aVF3U1BqN2prcXBkRmNqNlp4VEhGRjZvSVlXSGh4WG4yb3l6Z3B6NTBPNVc3OHphV05OULLMOHBMa2RTZmVKd3lzVDA2b2h3OTUxaFJ4QlN0dkxXallPcmhnSHNJb0tSV0M5ZzY1NkN4VGRvemFOSHY4b05c/callback", "GET", "/interactions/203039963636301824/!/callback"},
{"/api/channels/872712139712913438/messages/872712150509047809/reactions/PandaOhShit:863985751205085195", "GET", "/channels/872712139712913438/messages/!/reactions/!/!"},
{"/api/invites/dyno", "GET", "/invites/!"},

// Application commands
{"/api/v9/applications/203039963636301824/commands", "GET", "/applications/203039963636301824/commands"},
{"/api/v9/applications/203039963636301824/commands/203039963636301824", "GET", "/applications/203039963636301824/commands/!"},
}
for _, tt := range tests {
testname := fmt.Sprintf("%s-%s", tt.method, tt.path)
Expand All @@ -50,4 +52,4 @@ func TestPaths(t *testing.T) {
}
})
}
}
}
11 changes: 6 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,12 @@ func main() {
mux := manager.CreateMux()

s := &http.Server{
Addr: bindIp + ":" + port,
Handler: mux,
ReadTimeout: 10 * time.Second,
WriteTimeout: 1 * time.Hour,
MaxHeaderBytes: 1 << 20,
Addr: bindIp + ":" + port,
Handler: mux,
ReadHeaderTimeout: 10 * time.Second,
IdleTimeout: 10 * time.Second,
WriteTimeout: 1 * time.Hour,
MaxHeaderBytes: 1 << 20,
}

if os.Getenv("ENABLE_PPROF") == "true" {
Expand Down

0 comments on commit 3a912d0

Please sign in to comment.