Skip to content

Commit

Permalink
Wait 10s before using donation total API result
Browse files Browse the repository at this point in the history
  • Loading branch information
zoton2 committed Feb 22, 2024
1 parent 9cc15fa commit 1cd4c55
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/extension/tracker/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Configschema } from '@esa-layouts/types/schemas';
import { wait } from '@esa-layouts/util/helpers';
import type { Tracker } from '@shared/types';
import { round } from 'lodash';
import type { NeedleResponse } from 'needle';
Expand Down Expand Up @@ -76,6 +77,8 @@ async function updateDonationTotalFromAPITiltify(init = false): Promise<void> {
total += eventTotal;
}
total = round(total, 2);
// Wait 10s to just check we're not getting a new total just before a MQ message.
await wait(10 * 1000);
if (init || donationTotal.value < total) {
const oldTotal = donationTotal.value;
nodecg().sendMessage('donationTotalUpdated', { total });
Expand Down

0 comments on commit 1cd4c55

Please sign in to comment.