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

INF clear exporter's tallies for new proposals #3885

Merged
merged 1 commit into from
Sep 19, 2022
Merged
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
7 changes: 7 additions & 0 deletions monitoring/exporters/sdk/main.js
Original file line number Diff line number Diff line change
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