Skip to content

Commit

Permalink
fix: properly update node updatedAt when uptime received
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanVerstraete committed Jan 23, 2023
1 parent d5b15d8 commit f71488b
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion indexer/chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ name: tfchainindexer
description: Helm Chart for the tfchain hydra indexer
version: 2.7.6
apiVersion: v2
appVersion: '2.8.0-rc5'
appVersion: '2.8.0-rc6'
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "graphql_tfgrid",
"private": "true",
"version": "2.8.0-rc5",
"version": "2.8.0-rc6",
"description": "GraphQL server and Substrate indexer. Generated with ♥ by Hydra-CLI",
"author": "",
"license": "ISC",
Expand Down
2 changes: 1 addition & 1 deletion processor-chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v2
name: tfchain-processor
description: A chart for the tfchain graphql processor and query node
version: 1.0.5
appVersion: '2.8.0-rc5'
appVersion: '2.8.0-rc6'
10 changes: 5 additions & 5 deletions src/mappings/nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,16 +383,16 @@ export async function nodeUptimeReported(ctx: Ctx): Promise<void> {
let touchedNodes = new Map(
(await ctx.store.find(Node, {
where: {
id: In([...new Set(uptimes.map(up => up.event.nodeID)).keys()])
}
})).map(n => [n.id, n])
nodeID: In([...new Set(uptimes.map(up => up.event.nodeID)).keys()])
}, relations: { location: true, interfaces: true }
})).map(n => [n.nodeID, n])
)

for (let up of uptimes) {
let node = touchedNodes.get(up.event.nodeID.toString())
let node = touchedNodes.get(up.event.nodeID)
if (node) {
node.uptime = up.event.uptime
node.updatedAt = BigInt(up.block.timestamp)
node.updatedAt = BigInt(up.block.timestamp) / BigInt(1000)
}
}

Expand Down

0 comments on commit f71488b

Please sign in to comment.