mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-25 23:46:51 +00:00
perf: make app entries more scalable, avoid writing global entries since its just puter itself and isn't relevant (#2233)
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (24.x) (push) Has been cancelled
test / API tests (node env, api-test) (24.x) (push) Has been cancelled
test / puterjs (node env, vitest) (24.x) (push) Has been cancelled
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test-backend (24.x) (push) Has been cancelled
test / API tests (node env, api-test) (24.x) (push) Has been cancelled
test / puterjs (node env, vitest) (24.x) (push) Has been cancelled
This commit is contained in:
@@ -14,7 +14,7 @@ import { DynamoKVStore } from '../repositories/DynamoKVStore/DynamoKVStore.js';
|
||||
export class MeteringService {
|
||||
|
||||
static GLOBAL_SHARD_COUNT = 1000; // number of global usage shards to spread writes across
|
||||
static APP_SHARD_COUNT = 100; // number of app usage shards to spread writes across
|
||||
static APP_SHARD_COUNT = 1000; // number of app usage shards to spread writes across
|
||||
#kvStore: DynamoKVStore;
|
||||
#superUserService: SUService;
|
||||
#alarmService: AlarmService;
|
||||
@@ -125,13 +125,15 @@ export class MeteringService {
|
||||
console.warn('Failed to increment aux usage data \'actorAppUsageKey\' with error: ', e);
|
||||
});
|
||||
|
||||
const appUsageKey = this.#generateAppUsageKey(appId, currentMonth);
|
||||
this.#kvStore.incr({
|
||||
key: appUsageKey,
|
||||
pathAndAmountMap,
|
||||
}).catch((e: Error) => {
|
||||
console.warn('Failed to increment aux usage data \'appUsageKey\' with error: ', e);
|
||||
});
|
||||
if ( appId !== GLOBAL_APP_KEY ) {
|
||||
const appUsageKey = this.#generateAppUsageKey(appId, currentMonth);
|
||||
this.#kvStore.incr({
|
||||
key: appUsageKey,
|
||||
pathAndAmountMap,
|
||||
}).catch((e: Error) => {
|
||||
console.warn('Failed to increment aux usage data \'appUsageKey\' with error: ', e);
|
||||
});
|
||||
}
|
||||
|
||||
const actorAppTotalsKey = `${METRICS_PREFIX}:actor:${userId}:apps:${currentMonth}`;
|
||||
this.#kvStore.incr({
|
||||
|
||||
Reference in New Issue
Block a user