Skip to content

Commit

Permalink
chore(filer): add timeout for read and write
Browse files Browse the repository at this point in the history
  • Loading branch information
duanhongyi committed Sep 13, 2024
1 parent 4e768a6 commit 29ad972
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/filer.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ func main() {
bind := flag.String("bind", ":8100", "port to serve on")
path := flag.String("path", ".", "the directory of file to host")
buffsize := flag.Int64("buffsize", 32<<16, "memory size for multipart form")
duration := flag.Int64("duration", 3600, "provide a pass for the account")
waittime := flag.Int64("waittime", 1200, "provide a pass for the account")
duration := flag.Int64("duration", 3600, "start duration for filer")
waittime := flag.Int64("waittime", 1200, "close waittime for filer")
username := flag.String("username", "drycc", "provide a user for the account")
password := flag.String("password", "drycc", "provide a pass for the account")

Expand All @@ -25,8 +25,8 @@ func main() {
server := &http.Server{
Addr: *bind,
Handler: api.NewFilerHandler(*username, *password, *path, *buffsize, *duration, timer),
ReadTimeout: 10 * time.Second,
WriteTimeout: 10 * time.Second,
ReadTimeout: time.Duration(*duration) * time.Second,
WriteTimeout: time.Duration(*duration) * time.Second,
MaxHeaderBytes: 1 << 20,
}
go func() {
Expand Down

0 comments on commit 29ad972

Please sign in to comment.