Skip to content

Commit c2eb59b

Browse files
authored
Merge pull request #90 from blinklabs-io/feat/configure-ouroboros-timeout
feat: configurable timeout on ouroboros client
2 parents 98d2d8a + 3861106 commit c2eb59b

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

config.yaml.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,9 @@ node:
8080
# CARDANO_NODE_SOCKET_TCP_PORT environment variables
8181
address:
8282
port:
83+
84+
# Timeout for connections to cardano-node
85+
#
86+
# This can also be set via the CARDANO_NODE_SOCKET_TIMEOUT environment
87+
# variable
88+
timeout:

internal/api/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func handleSubmitTx(c *gin.Context) {
179179
ouroboros.WithNodeToNode(false),
180180
ouroboros.WithLocalTxSubmissionConfig(
181181
localtxsubmission.NewConfig(
182-
localtxsubmission.WithTimeout(5*time.Second),
182+
localtxsubmission.WithTimeout(time.Duration(cfg.Node.Timeout)*time.Second),
183183
),
184184
),
185185
)

internal/config/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ type NodeConfig struct {
4343
Address string `yaml:"address" envconfig:"CARDANO_NODE_SOCKET_TCP_HOST"`
4444
Port uint `yaml:"port" envconfig:"CARDANO_NODE_SOCKET_TCP_PORT"`
4545
SocketPath string `yaml:"socketPath" envconfig:"CARDANO_NODE_SOCKET_PATH"`
46+
Timeout uint `yaml:"timeout" envconfig:"CARDANO_NODE_SOCKET_TIMEOUT"`
4647
}
4748

4849
// Singleton config instance with default values
@@ -66,6 +67,7 @@ var globalConfig = &Config{
6667
Node: NodeConfig{
6768
Network: "mainnet",
6869
SocketPath: "/node-ipc/node.socket",
70+
Timeout: 30,
6971
},
7072
}
7173

0 commit comments

Comments
 (0)