Skip to content

Commit 3a912d0

Browse files
committed
Fix case where if timeout was too long the context would be canceled
1 parent 3b97175 commit 3a912d0

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

lib/bucketpath_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package lib
22

33
import (
4-
"fmt"
5-
"testing"
4+
"fmt"
5+
"testing"
66
)
77

88
func TestPaths(t *testing.T) {
@@ -39,7 +39,9 @@ func TestPaths(t *testing.T) {
3939
{"/api/interactions/203039963636301824/aW50ZXJhY3Rpb246ODg3NTU5MDA01AY4NTUxNDU0OnZwS3QycDhvREk2aVF3U1BqN2prcXBkRmNqNlp4VEhGRjZvSVlXSGh4WG4yb3l6Z3B6NTBPNVc3OHphV05OULLMOHBMa2RTZmVKd3lzVDA2b2h3OTUxaFJ4QlN0dkxXallPcmhnSHNJb0tSV0M5ZzY1NkN4VGRvemFOSHY4b05c/callback", "GET", "/interactions/203039963636301824/!/callback"},
4040
{"/api/channels/872712139712913438/messages/872712150509047809/reactions/PandaOhShit:863985751205085195", "GET", "/channels/872712139712913438/messages/!/reactions/!/!"},
4141
{"/api/invites/dyno", "GET", "/invites/!"},
42-
42+
// Application commands
43+
{"/api/v9/applications/203039963636301824/commands", "GET", "/applications/203039963636301824/commands"},
44+
{"/api/v9/applications/203039963636301824/commands/203039963636301824", "GET", "/applications/203039963636301824/commands/!"},
4345
}
4446
for _, tt := range tests {
4547
testname := fmt.Sprintf("%s-%s", tt.method, tt.path)
@@ -50,4 +52,4 @@ func TestPaths(t *testing.T) {
5052
}
5153
})
5254
}
53-
}
55+
}

main.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,12 @@ func main() {
8989
mux := manager.CreateMux()
9090

9191
s := &http.Server{
92-
Addr: bindIp + ":" + port,
93-
Handler: mux,
94-
ReadTimeout: 10 * time.Second,
95-
WriteTimeout: 1 * time.Hour,
96-
MaxHeaderBytes: 1 << 20,
92+
Addr: bindIp + ":" + port,
93+
Handler: mux,
94+
ReadHeaderTimeout: 10 * time.Second,
95+
IdleTimeout: 10 * time.Second,
96+
WriteTimeout: 1 * time.Hour,
97+
MaxHeaderBytes: 1 << 20,
9798
}
9899

99100
if os.Getenv("ENABLE_PPROF") == "true" {

0 commit comments

Comments
 (0)