Function
countAll
(bucket?: Tasks.TaskBucket)
Source from the content-addressed store, hash-verified
| 82 | } |
| 83 | |
| 84 | async 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 | |
| 107 | async function testDelSingular() { |
| 108 | let task1 = await bucket.schedule({ executeAt: new Date(Date.now() + 1000000), key: "1" }); |
Tested by
no test coverage detected