Skip to content
This repository was archived by the owner on Aug 11, 2026. It is now read-only.
This repository was archived by the owner on Aug 11, 2026. It is now read-only.

refactor(jobs): add shared worker runner, locks, batching, and JSON telemetry #697

Description

@ahliweb

Parent epic: #679

Context

The repository has multiple one-off jobs/workers with repeated concerns: tenant iteration, retries, locking, timeouts, safe logging, dry-run behavior, and exit status.

Objective

Provide a small shared runner for scheduled/internal jobs without introducing a separate orchestration platform.

Scope

  • Define job metadata, structured result, correlation/run ID, timeout, cancellation, and exit-code contract.
  • Add PostgreSQL advisory-lock support and bounded tenant/item batching.
  • Add dry-run support for mutating maintenance jobs where practical.
  • Standardize retry classification and safe JSON telemetry.
  • Keep external provider calls outside database transactions.
  • Migrate two representative jobs as proof, then document incremental adoption.

Acceptance criteria

  • Concurrent duplicate execution is rejected or safely skipped.
  • Lock release works on success, error, timeout, and termination.
  • Batches avoid unbounded transactions/memory.
  • Secrets and raw personal data are redacted.
  • Unit and PostgreSQL integration tests cover contention and partial failure.
  • Cron/systemd/container examples remain offline/LAN compatible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:architectureStruktur repo, module contract, registryarea:databaseSchema, migration, pooling, RLSpriority:p1Prioritas tinggi - core domaintype:taskAtomic implementation task

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions