@raybase/create 0.3.26 → 0.3.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raybase/create",
3
- "version": "0.3.26",
3
+ "version": "0.3.27",
4
4
  "description": "Scaffold secure internal apps powered by Raybase.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -353,9 +353,10 @@ Repeatable handlers must be safe when they run late or more than once:
353
353
  and schedule visibility before handing off.
354
354
  - Each failed attempt, and each run that ends failed without one (its lease
355
355
  expired, or it was denied), also logs `console.error("raybase.job.failed",
356
- { job, runId, organizationId, attempt, maxAttempts, retry, partitionKey })`
357
- for the Worker's logs and a host's tail events (`organizationId` is the
358
- run's scope, `"default"` in Core; `partitionKey` is the run's host
356
+ { job, runId, organizationId, reason, attempt, maxAttempts, retry,
357
+ partitionKey })` for the Worker's logs and a host's tail events (`reason`
358
+ is `threw`, `denied` or `lease_expired`; `organizationId` is the run's
359
+ scope, `"default"` in Core; `partitionKey` is the run's host
359
360
  partition, null for app-level work). It never includes the input; set
360
361
  `appConfig.jobs.logFailureMessages: true` only if the error messages hold
361
362
  nothing private, since that adds them as `error`.
@@ -662,15 +663,18 @@ export const jobs = {
662
663
  reaches the dead-letter queue.
663
664
  - A run counts toward its limits while its lease is live. The lease is the
664
665
  job's `leaseDuration`, else `appConfig.jobs.leaseDuration`, else `5 minutes`.
665
- When a worker dies mid-run, the slot frees as soon as the lease expires: the
666
- sweep fails the run and wakes the next waiter. A handler that outlives its
667
- lease stops counting toward the limit, is failed by the sweep, and has its
668
- completion refused.
669
- - Choose `leaseDuration` from the job's slowest handler. Use about twice its
670
- worst observed duration, and never less than its own timeouts, such as a
671
- model call's. A shorter lease gives a crashed run's slot back sooner. Give a
672
- seconds-long crawl job a lease of a minute or two, and give a minutes-long
673
- inference job its own longer lease rather than raising the app-wide default.
666
+ A running run renews its lease every third of it while its invocation
667
+ lives, so a handler may run longer than its lease. When a worker dies
668
+ mid-run, the renewals stop and the slot frees as soon as the lease expires:
669
+ the sweep fails the run (`raybase.job.failed` with `reason:
670
+ "lease_expired"`) and wakes the next waiter.
671
+ - So `leaseDuration` is how long a dead run's slot stays held, not how long a
672
+ run may take. A shorter lease frees a crashed run's slot sooner and renews
673
+ more often; the default suits most jobs. What bounds a run is its
674
+ invocation: Cloudflare ends a queue consumer invocation at its wall-time
675
+ limit (15 minutes at the time of writing), and then the run's lease lapses
676
+ and the sweep fails it. Split work longer than that into batches or
677
+ continuations (`ctx.jobs.enqueue` from the handler).
674
678
  - Cancelling a run frees its slot at once, but its handler keeps running to
675
679
  the end and its result is discarded. The next waiter can therefore start
676
680
  while the cancelled handler is still finishing, and until it finishes the
@@ -184,7 +184,8 @@ ctx)` in the worker entry, ahead of the framework, as the templates have it;
184
184
  `raybase doctor` warns (`host-routing`) when it is missing. Each failed job
185
185
  attempt, and each run that ends failed without one (lease expired, denied),
186
186
  logs `console.error("raybase.job.failed", { job, runId, organizationId,
187
- attempt, maxAttempts, retry, partitionKey })` (`organizationId` the run's
187
+ reason, attempt, maxAttempts, retry, partitionKey })` (`reason` `threw`,
188
+ `denied` or `lease_expired`) (`organizationId` the run's
188
189
  scope, `"default"` in Core; `partitionKey` null for app-level work), never with the input, and with the error's message only under
189
190
  `appConfig.jobs.logFailureMessages: true`. See the
190
191
  hosting guide (`docs/hosting.md` on the Raybase site) for the full contract.