Skip to content

Commit

Permalink
INF clear exporter's tallies for new proposals (#3885)
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquincasares committed Sep 19, 2022
1 parent fb87b2e commit 5c199d6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions monitoring/exporters/sdk/main.js
Expand Up @@ -73,6 +73,12 @@ const OUTCOME = Object.freeze({
let PREVIOUSLY_SEEN_PROPOSAL_ID = 0
const PROPOSAL_OUTCOME_TALLY = {}

const clearTally = () => {
for (const outcome in PROPOSAL_OUTCOME_TALLY) {
delete PROPOSAL_OUTCOME_TALLY[outcome];
}
}

const tallyProposalOutcomes = (outcome) => {
if (!PROPOSAL_OUTCOME_TALLY[outcome]) {
PROPOSAL_OUTCOME_TALLY[outcome] = 0
Expand All @@ -89,6 +95,7 @@ const scanGovernanceProposals = async () => {
// and export new metrics
if (PREVIOUSLY_SEEN_PROPOSAL_ID !== parseInt(lastProposal.proposalId)) {
let unknownProposerCount = 0
clearTally()

// scan all proposals and...
for (const proposal of proposals) {
Expand Down

0 comments on commit 5c199d6

Please sign in to comment.