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

change the real-time network stats lambda to return a nodeCounts object instead of a nodes array #170

Open
gruns opened this issue Dec 19, 2022 · 0 comments

Comments

@gruns
Copy link
Contributor

gruns commented Dec 19, 2022

current "nodes" array looks like:

"nodes":[
   {"count":563,"state":"active"},
   {"count":2,"state":"down"},
   {"count":8,"state":"inactive"}]

new object should look like this:

"nodeCounts": {
   "inactive": 563,
   "down": 2,
   "inactive": 8}

why the change? bc the former led to a bug where the first entry in the "nodes" array was implicitly assumed to be the "active" nodes. which it was not always. only sometimes

thus the bug fix was to loop through the entries. this 10 lines of js:

which goes away entirely with the better nodeCounts datastructure:

const pops = jsonResponse?.nodeCounts?.active || [default]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant