Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RED-52: remove dynamic edge config #6

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 0 additions & 3 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
sleep,
cleanBadNodes,
initSyncTime,
updateEdgeNodeConfig,
} from './utils'
import { router as logRoute } from './routes/log'
import { router as authenticate } from './routes/authenticate'
Expand Down Expand Up @@ -204,12 +203,10 @@ setupArchiverDiscovery({
debug_info.txRecordingStartTime = config.recordTxStatus ? Date.now() : 0
setConsensorNode()
initSyncTime()
updateEdgeNodeConfig()
setInterval(updateNodeList, config.nodelistRefreshInterval)
setInterval(saveTxStatus, 5000)
setInterval(checkArchiverHealth, 60000)
setInterval(cleanBadNodes, 60000)
setInterval(updateEdgeNodeConfig, 60000 * 5)
extendedServer.listen(port, function () {
console.log(`JSON RPC Server listening on port ${port} and chainId is ${chainId}.`)
setupDatabase()
Expand Down
16 changes: 0 additions & 16 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ export const node = {
port: 9001,
}

let rotationEdgeToAvoid = 0

const badNodesMap: Map<string, number> = new Map()

const verbose = config.verbose
Expand Down Expand Up @@ -153,20 +151,6 @@ export function removeFromNodeList(ip: string, port: string): void {
nodeList = nodeList.filter((node) => node.ip !== ip || node.port !== Number(port))
}

export async function updateEdgeNodeConfig(): Promise<void> {
console.log(`Updating rotationEdgeToAvoid configuration`)

const res = await requestWithRetry(RequestMethod.Get, `/netconfig`)

if (res.data && res.data.config) {
const newRotationEdgeToAvoid = res.data.config.p2p.rotationEdgeToAvoid
rotationEdgeToAvoid = newRotationEdgeToAvoid
console.log(`Setting rotationEdgeToAvoid to ${newRotationEdgeToAvoid}`)
} else if (res.data && res.data.error) {
console.log(`Error getting rotationEdgeToAvoid configuration: ${res.data.error}`)
}
}

export async function checkArchiverHealth(): Promise<void> {
console.info('\n====> Checking Health of Archivers <====')
const archiverData: ArchiverStat[] = await getArchiverStats()
Expand Down
Loading