Skip to content
This repository has been archived by the owner on Oct 8, 2020. It is now read-only.

Added timeouts for channels #29

Merged
merged 2 commits into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/medco.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ const (
optionConfig = "config"
optionConfigShort = "c"

optionTimeout = "timeout"
optionTimeoutShort = "t"

optionGroupFile = "file"
optionGroupFileShort = "f"

Expand Down Expand Up @@ -122,6 +125,12 @@ func main() {
Name: optionConfig + ", " + optionConfigShort,
Usage: "Configuration file of the server",
},
cli.Int64Flag{
Name: optionTimeout + ", " + optionTimeoutShort,
Usage: "Communication timeout (in minutes)",
Required: false,
Value: 20,
},
}

nonInteractiveSetupFlags := []cli.Flag{
Expand Down
5 changes: 5 additions & 0 deletions app/server.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package main

import (
servicesmedco "github.com/ldsec/medco-unlynx/services"
"time"

// Empty imports to have the init-functions called which should
// register the protocol
_ "github.com/ldsec/medco-unlynx/services"
Expand All @@ -12,8 +15,10 @@ import (
func runServer(ctx *cli.Context) error {
// first check the options
config := ctx.String("config")
timeout := ctx.Int64("timeout")

app.RunServer(config)

servicesmedco.TimeoutService = time.Duration(timeout) * time.Minute
return nil
}
Loading