Skip to content

Commit

Permalink
add auto dial property
Browse files Browse the repository at this point in the history
  • Loading branch information
paulo-ocean committed Aug 6, 2024
1 parent c4c95de commit 886c74e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions env.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Environmental variables are also tracked in `ENVIRONMENT_VARIABLES` within `src/
- `P2P_AUTODIALPEERRETRYTHRESHOLD`: When we've failed to dial a peer, do not autodial them again within this number of ms. Default: 1000 \* 120
- `P2P_AUTODIALCONCURRENCY`: When dialling peers from the peer book to keep the number of open connections, add dials for this many peers to the dial queue at once. Default: 5
- `P2P_MAXPEERADDRSTODIAL`: Maximum number of addresses allowed for a given peer before giving up. Default: 5
- `P2P_AUTODIALINTERVAL`: Auto dial interval (miliseconds). Amount of time between close and open of new peer connection. Default: 5000

## Additional Nodes (Test Environments)

Expand Down
1 change: 1 addition & 0 deletions src/@types/OceanNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export interface OceanNodeP2PConfig {
autoDialPeerRetryThreshold: number
autoDialConcurrency: number
maxPeerAddrsToDial: number
autoDialInterval: number
}

export interface OceanNodeConfig {
Expand Down
3 changes: 2 additions & 1 deletion src/components/P2P/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,8 @@ export class OceanP2P extends EventEmitter {
maxConnections: config.p2pConfig.maxConnections,
autoDialPeerRetryThreshold: config.p2pConfig.autoDialPeerRetryThreshold,
autoDialConcurrency: config.p2pConfig.autoDialConcurrency,
maxPeerAddrsToDial: config.p2pConfig.maxPeerAddrsToDial
maxPeerAddrsToDial: config.p2pConfig.maxPeerAddrsToDial,
autoDialInterval: config.p2pConfig.autoDialInterval
}
}
if (config.p2pConfig.bootstrapNodes && config.p2pConfig.bootstrapNodes.length > 0) {
Expand Down
3 changes: 2 additions & 1 deletion src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,8 @@ async function getEnvConfig(isStartup?: boolean): Promise<OceanNodeConfig> {
1000 * 120
),
autoDialConcurrency: getIntEnvValue(process.env.P2P_AUTODIALCONCURRENCY, 5),
maxPeerAddrsToDial: getIntEnvValue(process.env.P2P_MAXPEERADDRSTODIAL, 5)
maxPeerAddrsToDial: getIntEnvValue(process.env.P2P_MAXPEERADDRSTODIAL, 5),
autoDialInterval: getIntEnvValue(process.env.P2P_AUTODIALINTERVAL, 5000)
},
// Only enable provider if we have a DB_URL
hasProvider: !!getEnvValue(process.env.DB_URL, ''),
Expand Down

0 comments on commit 886c74e

Please sign in to comment.