Public: anyone can read this; the crew can change it.

The paid-order making watch runs its asks inside during, so main's timer test passes (#16376) #16379

Closed opened this From outsidein answer to
Closed without merging

grokbot/forge:timers-during → main 1 commit fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
3 files changed +6 −2
src/actions/order.ts +4 −2
@@ -25,6 +25,7 @@ import { checkoutOf } from "../billing/checkout.ts";
2525 import { getOrder, holdName, markResent, markShown, move, takeTurn, unmarkShown, pendingFrom, MAX_PENDING_PER_ADDRESS, CHECKOUT_MS, nameHeld, newId, newTicket, dropPending, pendingCount, setSession, spawnedFor, ticketFits, MAX_PENDING, type Order } from "../billing/orders.ts";
2626 import { putEntitlement } from "../billing/store.ts";
2727 import { heldOf } from "../perf/held.ts";
28 import { during } from "../perf/jobs.ts";
2829 import { getUserByName, type User } from "../core/users.ts";
2930 import { publicOrigin } from "../core/public_origin.ts";
3031 import { err, ok, type Result } from "../kernel/result.ts";
@@ -257,7 +258,8 @@ export const makingWatch = { everyMs: ASK_MS, tries: 60 };
257258 /**
258259 * A buyer who closed the page still gets the link by mail: this process asks after the order
259260 * every `makingWatch.everyMs`, for at most `tries`, until it is no longer `making`. Holds nothing
260 * but its own timer (unref'd); a restart drops it, and the return page asks again.
261 * but its own timer (unref'd), a sleep; each ask runs inside `during("order-making")`, so a stall
262 * names it. A restart drops it, and the return page asks again.
261263 */
262264 async function followMaking(app: App, id: string): Promise<void> {
263265 try {
@@ -265,7 +267,7 @@ async function followMaking(app: App, id: string): Promise<void> {
265267 await new Promise((r) => setTimeout(r, makingWatch.everyMs).unref());
266268 const o = getOrder(app.db, id);
267269 if (o?.state !== "making") return;
268 await askMaking(app, o, Date.now());
270 await during("order-making", () => askMaking(app, o, Date.now()), undefined, app);
269271 }
270272 } catch (e) {
271273 app.log.warn("a making order could not be asked after", { id, says: String(e).slice(0, 200) });
test/job-slices.test.ts +1
@@ -274,6 +274,7 @@ const UNTIMED: Record<string, string> = {
274274 ledger: "walks the cost ledger's hash chain at boot and once a day (#12273): file reads proportional to the ledger, off the request path; the fixture has no ledger",
275275 "full-disk-probe": "one 64 KiB write every 2 s, only while the disk is full; the full-disk test drives probeFull directly",
276276 "reach-asks": "a one-shot timer in actions/ask_host.ts, armed only while a hosted forge has an ask under an hour old: one signed call to its host over the network and a few rows; the fixture has no host",
277 "order-making": "one ask after a paid order's cloud forge every ASK_MS (actions/order.ts followMaking), only while an order is making: a row read and one probe of the forge's name over the network; the fixture has no paid orders, and order-cloud.test.ts drives the same ask through reconcileOrder",
277278 "run-ending": "a one-shot timer in runs/ending.ts, armed only while a cancel waits on a worker here: at its deadline it announces the run once (a row read and one outbox write); run-cancel-stopping.test.ts drives whenEnded directly",
278279 lane: "a closure in startChecks; starting the checks service starts cell checks — follow-up",
279280 "lane-catch-up": "a closure in startChecks, once on boot; same as lane",
test/timers-named.test.ts +1
@@ -137,6 +137,7 @@ const ALLOWED: readonly Allowed[] = [
137137 ["src/cli/commands/sync.ts", "resolve"],
138138 ["src/cli/commands/talk.ts", "resolve"],
139139 ["src/flow/lanes.ts", "resolve"],
140 ["src/actions/order.ts", "r"],
140141 ]),
141142 ...allow("setTimeout", DEADLINE, [
142143 ["src/release/announce.ts", "() => res(false)"],

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs