SERVER / TASKS

Start isolated work now

Tasks start detached server work immediately. The caller continues without a result while Dowe runs the work in an isolated worker.

Scheduled cron jobs

1 / NAMED TASKS

Reuse an imported server function

Use a named task when the detached work belongs in a reusable server module. The caller evaluates args before the worker starts, then returns immediately.

dowe
import writeAudit from "@/server/tasks/write-audit"

handler createOrder
  const order value:req.json
  task fn:writeAudit args:{ orderId:order.id event:"order.created" }
  return status:202 json:{ accepted:true }
Rule
What it means

No data

There are no records to display

2 / REVERSE-PROXY TELEMETRY

Measure a real upstream response

Tasks are immediate by default. Only a direct handler that finishes with return reverse can opt into after headers timing.

dowe
import RouteCache from "@/server/config/cache"
import emitTelemetry from "@/server/tasks/telemetry"

handler forwardRequest
  request host source:"header" name:"Host"
  kv route conn:RouteCache.get key:host required:true
  task fn:emitTelemetry args:{ event:{ projectId:route.projectId status:0 method:"" path:"" latencyMs:0 bytesIn:0 bytesOut:0 custom:"edge" } } after:"headers"
  return reverse:route.url
Rule
What it means

No data

There are no records to display

3 / INLINE TASKS

Keep small detached work local

An inline task is useful when the work is short and does not deserve a reusable module. Its body has its own worker scope.

dowe
handler createOrder
  const order value:req.json
  task args:{ orderId:order.id }
    str auditKey source:"join" values:["order" args.orderId] delimiter:":"
    log "queued audit" auditKey
  return status:202 json:{ accepted:true }
Rule
What it means

No data

There are no records to display

4 / PROCESS BOUNDARY

Choose tasks for non-critical work

Tasks do not expose cancellation, inspection, retry, or durable delivery. Use cron for UTC schedules, and keep a request synchronous when its response depends on the result.

A task is detached execution, not durable delivery. Use Queue when the work must survive process failure, be inspected, or be acknowledged by a consumer.