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

Commit

Permalink
Merge pull request #29 from ldsec/timeouts
Browse files Browse the repository at this point in the history
Added timeouts for channels
  • Loading branch information
mickmis committed Feb 10, 2020
2 parents 554017b + 2b7f892 commit a6dfdc4
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 61 deletions.
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

0 comments on commit a6dfdc4

Please sign in to comment.