MCPcopy Create free account
hub / github.com/Botloader/botloader / countAll

Function countAll

integration-tests/tasks_get_del_bucket.ts:84–105  ·  view source on GitHub ↗
(bucket?: Tasks.TaskBucket)

Source from the content-addressed store, hash-verified

82}
83
84async function countAll(bucket?: Tasks.TaskBucket): Promise<number> {
85 let last = 0;
86 let n = 0;
87 while (true) {
88 const batch = bucket
89 ? await bucket.getMany({
90 afterId: last,
91 })
92 : await Tasks.getMany({
93 afterId: last,
94 });
95
96 if (batch && batch.length > 0) {
97 last = batch[batch.length - 1].id;
98 n += batch.length;
99 } else {
100 break;
101 }
102 }
103
104 return n
105}
106
107async function testDelSingular() {
108 let task1 = await bucket.schedule({ executeAt: new Date(Date.now() + 1000000), key: "1" });

Callers 1

testGetAllFunction · 0.70

Calls 1

getManyMethod · 0.80

Tested by

no test coverage detected