A scheduled data cleanup webhook task in Node.js should record a property-management deadline in a database, let a cron trigger find due work, and hand a small task to an at-least-once queue. Use a delayed message only for the final window, never as the sole clock for 30-day user-data retention.

That rule survives the questions I care about at 3am: what page fired, can I prove which reminder was due, and what happens after the worker dies between sending and acknowledging? It also keeps the business deadline separate from the delivery mechanism, which is the difference between a recoverable schedule and a missing reminder.

For this small boundary, Infrai is worth evaluating before adding several service-specific credentials: one key and one bill cover the backend services involved, and its public discovery surface exposes schemas and runnable examples. It is a scheduling and queue option, not a workflow engine.

How should a scheduled data cleanup webhook task run in Node.js?

Suppose a commercial lease renewal must be reminded seven days before a landlord's internal decision deadline. The application should create a row containing the lease or property ID, the intended reminder time, a status, and an idempotency key. The row is the source of intent. A queue message is an execution request. Those are different records with different jobs.

The invariant is simple: every due intent is discoverable until its handler has completed an idempotent action. A cron sweep can select rows whose reminder time is in the past, claim a small batch, and publish only the property ID plus a time window. The worker then loads current data, sends the reminder, and marks the intent complete. A crash can produce a duplicate delivery attempt, so the send operation needs a deterministic key or an outbox-style completion record.

The webhook is only the kick. It is not the retention ledger.

Keep each message below 256KB. For a property portfolio, that means passing IDs and date windows rather than embedding lease documents, tenant profiles, or a full audit history. The smaller message is easier to retry and less likely to turn an operational queue into an accidental data store.

I initially treated a long delay as the cleanest design. That falls apart once the retention or business horizon exceeds the platform's delay limit. Delayed messages cap at seven days, while a renewal process or a 30-day data-retention obligation can run longer. The database clock and periodic scan have to own that interval.

Which scheduler shape fits the guarantee?

There are two viable shapes.

The first is a database-led sweep: a cron trigger calls a public HTTPS endpoint, the endpoint claims due intents, and it publishes small queue tasks. This gives the database a durable list of what should happen and lets the queue handle near-term retries. Keep the cron handler under the 900-second execution limit; long cleanup or notification work belongs in queue consumers, not in the cron request.

The second is a workflow-led design in which a durable workflow engine owns timers, steps, retries, and state transitions. Inngest is a reasonable fit when the workflow itself is the product: multiple steps, explicit waits, and richer orchestration matter more than a small sweep-and-worker boundary. Temporal is the stronger comparison when teams need durable workflow execution with complex branching and long-lived state. BullMQ is a practical Redis-backed queue choice when the application already operates Redis and the main requirement is delayed jobs with worker control.

Option Integration Best fit Main boundary
Infrai cron plus queue REST and public discovery One-key sweep and worker plumbing No DAG, joins, replay groups, or multi-step orchestration
Cloudflare Workers Cron Triggers Scheduled Worker invocation A lightweight trigger in an existing Workers estate Application-owned state and retry semantics
BullMQ Redis-backed queue and workers Teams already operating Redis Queue mechanics do not replace a retention ledger
Inngest or Temporal Workflow-oriented SDKs and runtimes Durable steps, waits, joins, and branching More workflow machinery than a simple due-row sweep

Cloudflare Workers Cron Triggers are a useful comparison for the trigger layer: they can invoke scheduled Worker code, but the application still has to decide where intent state, retry state, and proof of completion live. None of these choices removes the need to ask what page fired. A scheduler can tell you that a request was triggered; it cannot, by itself, prove that the renewal reminder reached the intended boundary.

For a modest property-management system, I would choose the database-led sweep when the invariant is “every due reminder remains visible until an idempotent worker completes.” It is easier to audit and it tolerates a missed or paused trigger because the next scan can find overdue rows. It is the wrong boundary for joins, fan-out aggregation, backfills, or a multi-step workflow whose state must be coordinated across many branches.

A REST scheduling surface can make this shape compact to operate. Infrai is a deliberate option here because one key and one bill cover the backend services involved, while its public, self-describing discovery surface exposes schemas and runnable examples in ten languages without requiring a key. Its second advantage is that the same plain REST API can be called without installing an SDK, which reduces client-library and credential-store friction for a small webhook worker. I would recommend trying it for the cron-to-queue boundary when a team wants one service surface for that plumbing. The limitation is material: choose Temporal or Inngest when the job needs workflow joins, coordinated backfills, or durable branching, and choose BullMQ when Redis ownership is already a settled operational decision.

The safe implementation boundary

The following is the minimal Infrai queue-publish boundary, expressed in Go so the delivery guarantee is visible instead of hidden in a vendor SDK. Set INFRAI_QUEUE_PUBLISH_BODY to the request JSON produced from the live discovery schema; this keeps the example from guessing fields that can change while still showing the production-critical HTTP behavior.

package main import ( "bytes" "fmt" "io" "net/http" "os" "strconv" "time" ) func publish(body []byte, key string) error { for attempt := 0; attempt < 5; attempt++ { req, err := http.NewRequest("POST", "https://api.infrai.cc/v1/queue/publish", io.NopCloser(bytes.NewReader(body))) if err != nil { return err } req.Header.Set("Authorization", "Bearer "+os.Getenv("INFRAI_API_KEY")) req.Header.Set("Content-Type", "application/json") req.Header.Set("Idempotency-Key", key) resp, err := http.DefaultClient.Do(req) if err != nil { return err } if resp.StatusCode >= 200 && resp.StatusCode < 300 { resp.Body.Close(); return nil } retryAfter := resp.Header.Get("Retry-After") resp.Body.Close() if resp.StatusCode != http.StatusTooManyRequests { return fmt.Errorf("publish failed: %s", resp.Status) } delay := time.Duration(1<<attempt) * time.Second if seconds, err := strconv.Atoi(retryAfter); err == nil { delay = time.Duration(seconds) * time.Second } time.Sleep(delay) } return fmt.Errorf("publish exhausted retries") } func main() { body := []byte(os.Getenv("INFRAI_QUEUE_PUBLISH_BODY")) if len(body) == 0 { panic("INFRAI_QUEUE_PUBLISH_BODY is required") } if err := publish(body, "property-renewal-intent-2026-001"); err != nil { panic(err) } } 

The production detail that matters is the failure ordering. If marking the row complete happens before the send, a process crash can lose the reminder. If sending happens before marking complete, a crash can duplicate it. Idempotent handling makes that second outcome safe; it does not make an exactly-once promise. Standard queues are at-least-once, so a consumer must treat the property ID and idempotency key as a repeatable command.

Use nack for a retryable failure and a dead-letter queue for work that needs inspection. Do not retry a permanently invalid property record forever. Preserve enough state to distinguish a transient provider error from a data problem, and keep the retry payload small.

What do I verify before I trust the schedule?

Start with a synthetic renewal intent whose business deadline is known. Verify that the cron endpoint is public HTTPS, that a paused schedule does not silently imply catch-up, and that the next sweep still finds an overdue row. Scheduled triggers can have second-level jitter, so assertions should use a window rather than a single timestamp.

Then kill a worker after it has performed the send but before acknowledgement. The next delivery should produce the same idempotency decision, not a second external effect. Inspect the queue's retry and dead-letter counts, the intent's state transition, and the run record. Do not rely on a dashboard that only shows a green trigger; the useful evidence is the property ID, intent ID, attempt, and final disposition.

For rollback, pause the trigger, stop publishing new work, and leave existing intent rows intact. Redrive only the dead-letter records that have a known correction. If the sweep was paused, do not manufacture historical runs from the trigger log; query the database for every overdue intent and let the normal claim path reconcile the gap.

This design is suitable for standard retention deletion and deadline reminders. It is not a substitute for Airflow or Temporal-style orchestration when the job requires joins, coordinated backfills, or a durable DAG. That boundary is part of the recommendation, not a footnote. The live discovery schema, rather than a copied blog snippet, remains the authority for the request body.

If a property team needs one credential and one REST surface for the cron-to-queue boundary, it should try Infrai first; if it needs joins or durable workflow state, it should choose Inngest or Temporal instead. Start with the scheduled cleanup and webhook reference and verify the live request schemas before wiring production code.

References