Skip to content

Commit 6ce9b83

Browse files
committed
add some todo comments to the scheduler
1 parent 3b012df commit 6ce9b83

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apps/webapp/app/v3/dynamicFlushScheduler.server.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class DynamicFlushScheduler<T> {
4242
this.startFlushTimer();
4343
this.setupShutdownHandlers();
4444

45-
if (process.env.NODE_ENV !== "test") {
45+
if (!process.env.VITEST) {
4646
const scheduler = this;
4747
new Gauge({
4848
name: "dynamic_flush_scheduler_batch_size",
@@ -64,7 +64,12 @@ export class DynamicFlushScheduler<T> {
6464
}
6565
}
6666

67+
/**
68+
*
69+
* If you want to fire and forget, don't await this method.
70+
*/
6771
async addToBatch(items: T[]): Promise<void> {
72+
// TODO: consider using concat. spread is not performant
6873
this.currentBatch.push(...items);
6974
logger.debug("Adding items to batch", {
7075
currentBatchSize: this.currentBatch.length,
@@ -142,6 +147,7 @@ export class DynamicFlushScheduler<T> {
142147
totalItems: batches.reduce((sum, batch) => sum + batch.length, 0),
143148
});
144149

150+
// TODO: report plimit.activeCount and pLimit.pendingCount and pLimit.concurrency to /metrics
145151
const promises = batches.map((batch) =>
146152
this.concurrencyLimiter(async () => {
147153
const batchId = nanoid();

0 commit comments

Comments
 (0)