(type: string)
| 126 | |
| 127 | /** Run a worker cron on demand via the local /debug/cron endpoint. */ |
| 128 | export async function triggerCron(type: string) { |
| 129 | const res = await fetch(`${WORKER_URL}/debug/cron/${type}`, { |
| 130 | method: 'POST', |
| 131 | headers: { accept: 'application/json' }, |
| 132 | }); |
| 133 | if (!res.ok) { |
| 134 | throw new Error(`trigger cron ${type} ${res.status}: ${await res.text()}`); |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | export const triggerReaper = () => triggerCron('sessionReaper'); |
| 139 |
no test coverage detected