Skip to content

Commit

Permalink
fix issue with Daemon when no file present for a given IPFS hash
Browse files Browse the repository at this point in the history
  • Loading branch information
thebeast0407 committed Jan 3, 2019
1 parent 75c8252 commit a6d3113
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ see [rate limiting configuration](./ratelimit/README.md)

* **heartbeat_svc_end_point** (optional; default: `""`) - It must be a valid URL. if it is empty, then service state always assumed as SERVING, and same will be wrapped in Daemon Heartbeat. see [daemon heartbeats configuration](./metrics/README.md)

* **ipfs_timeout** (optional; default: `30`) - All IPFS read/writes timeout if the operations doesnt complete in 30 sec or set duration in this config entry.

#### Environment variables and CLI parameters

Expand Down
2 changes: 2 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const (
HdwalletIndexKey = "hdwallet_index"
HdwalletMnemonicKey = "hdwallet_mnemonic"
IpfsEndPoint = "ipfs_end_point"
IpfsTimeout = "ipfs_timeout"
LogKey = "log"
MonitoringEnabled = "monitoring_enabled"
MonitoringServiceEndpoint = "monitoring_svc_end_point"
Expand Down Expand Up @@ -62,6 +63,7 @@ const (
"hdwallet_index": 0,
"hdwallet_mnemonic": "",
"ipfs_end_point": "http://localhost:5002/",
"ipfs_timeout" : 30,
"monitoring_enabled": true,
"monitoring_svc_end_point": "https://n4rzw9pu76.execute-api.us-east-1.amazonaws.com/beta",
"organization_id": "ExampleOrganizationId",
Expand Down
3 changes: 3 additions & 0 deletions ipfsutils/ipfsutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
log "github.com/sirupsen/logrus"
"io/ioutil"
"strings"
"time"
)

func GetIpfsFile(hash string) string {
Expand Down Expand Up @@ -43,5 +44,7 @@ func GetIpfsFile(hash string) string {

func GetIpfsShell() *shell.Shell {
sh := shell.NewShell(config.GetString(config.IpfsEndPoint))
// sets the timeout for accessing the ipfs content
sh.SetTimeout(time.Duration(config.GetInt(config.IpfsTimeout)) * time.Second)
return sh
}

0 comments on commit a6d3113

Please sign in to comment.