Skip to content

Commit

Permalink
Merge pull request ZeStream#46 from vivek378521/feat/add-timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
uzaxirr authored Jan 5, 2023
2 parents 0ee1422 + bbb0873 commit 725ef53
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ const S3_REGION = "us-east-1"
const AWS_ENDPOINT = "http://localhost:4566"
const PRESIGNED_URL_EXPIRATION = 60 * time.Minute
const OUTPUT_FILE_PATH_PREFIX = "output"
const READ_TIMEOUT = 5 * time.Second
const WRITE_TIMEOUT = 5 * time.Second
const IDLE_TIMEOUT = 30 * time.Second
const DEFAULT_THUMBNAIL_TIMESTAMP = "00:00:02"

const GCP_BUCKET_NAME = "zstream-bucket"
const GCP_PROJECT_ID = ""
const AZURE_ACCOUNT_NAME = ""
Expand Down
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ func main() {
port = constants.DEFAULT_PORT
}

err := http.ListenAndServe(port, nil)
server := &http.Server{
Addr: port,
ReadTimeout: constants.READ_TIMEOUT,
WriteTimeout: constants.WRITE_TIMEOUT,
IdleTimeout: constants.IDLE_TIMEOUT,
}

err := server.ListenAndServe()

if err != nil {
fmt.Println(err)
Expand Down

0 comments on commit 725ef53

Please sign in to comment.