(atLeast: number)
| 226 | // Attempts against THIS org's meter, polled until the seam has settled on |
| 227 | // `atLeast` of them — the ledger is the only place the retry is visible. |
| 228 | const trackAttempts = (atLeast: number) => |
| 229 | autumn.ledgerFor("balances.track").pipe( |
| 230 | Effect.map((entries) => entries.filter((entry) => entry.customerId === customerId)), |
| 231 | Effect.filterOrFail( |
| 232 | (entries) => entries.length >= atLeast, |
| 233 | (entries) => `only ${entries.length}/${atLeast} usage-track attempts for ${customerId}`, |
| 234 | ), |
| 235 | Effect.retry(Schedule.both(Schedule.spaced("250 millis"), Schedule.recurs(40))), |
| 236 | ); |
| 237 | |
| 238 | yield* Effect.gen(function* () { |
| 239 | // "No such customer" that does NOT go away when the customer is created — |
no test coverage detected