openvibers/openvibe.live Commits
Home money counts: billing-stats reads Billing through the client's api object (the module root has no stats(); the home showed the tiles empty) (#186)
Changes
@@@ -10,7 +10,7 @@* One Billing read serves both, cached five minutes (a failure is cached for a minute and answers null: the board* shows the tiles empty rather than a guess).*/--const api = require('./billing-client');++const { api } = require('./billing-client');const TTL_MS = 5 * 60_000;const MISS_MS = 60_000;@@@ -9,7 +9,7 @@const assert = require('assert');(async () => {-- const api = require('../server/monetization/billing-client');++ const { api } = require('../server/monetization/billing-client'); // the module's api object, as billing-stats.js uses itlet calls = 0;let fail = false;const days = Array.from({ length: 90 }, (_, i) => ({ day: new Date(Date.now() - (89 - i) * 86400000).toISOString().slice(0, 10), value: i === 89 ? 500 : (i === 88 ? 250 : 0) }));
@@ -10,7 +10,7 @@
@@ -10,7 +10,7 @@
* One Billing read serves both, cached five minutes (a failure is cached for a minute and answers null: the board
* One Billing read serves both, cached five minutes (a failure is cached for a minute and answers null: the board
* shows the tiles empty rather than a guess).
* shows the tiles empty rather than a guess).
*/
*/
-const api = require('./billing-client');
+const { api } = require('./billing-client');
const TTL_MS = 5 * 60_000;
const TTL_MS = 5 * 60_000;
const MISS_MS = 60_000;
const MISS_MS = 60_000;
@@ -9,7 +9,7 @@
@@ -9,7 +9,7 @@
const assert = require('assert');
const assert = require('assert');
(async () => {
(async () => {
- const api = require('../server/monetization/billing-client');
+ const { api } = require('../server/monetization/billing-client'); // the module's api object, as billing-stats.js uses it
let calls = 0;
let calls = 0;
let fail = false;
let fail = false;
const days = Array.from({ length: 90 }, (_, i) => ({ day: new Date(Date.now() - (89 - i) * 86400000).toISOString().slice(0, 10), value: i === 89 ? 500 : (i === 88 ? 250 : 0) }));
const days = Array.from({ length: 90 }, (_, i) => ({ day: new Date(Date.now() - (89 - i) * 86400000).toISOString().slice(0, 10), value: i === 89 ? 500 : (i === 88 ? 250 : 0) }));