API Reference shigoto v#1.9.10

View Source

Modules

Public API for the Shigoto background job system.

Batch/workflow system for Shigoto. Groups jobs into batches with completion and discard callbacks.

Configuration access for Shigoto. Reads from application env.

Cron scheduler. Checks configured cron expressions every minute and inserts jobs for entries that are due. On startup, catches up on any missed intervals since the last run.

Parses standard 5-field cron expressions and checks if a given datetime matches. Fields: minute, hour, day-of-month, month, day-of-week.

AES-256-GCM encryption for job args at rest.

Dashboard queries for Shigoto. Provides statistics and search functions for building admin UIs, monitoring dashboards, and Nova Liveboard pages.

Every statement shigoto runs goes through here.

Executes a single job through the middleware chain with seki resilience. Started by the executor supervisor, reports back to the queue process when done.

Fanout queue — every node processes every job. Used for broadcast events like session revocation, notifications, and cross-node chat.

Heartbeat system for executing jobs. Periodically updates heartbeat_at for all in-flight jobs on this node, enabling faster stale job detection.

Composable middleware chain for job execution.

Periodically archives old completed and discarded jobs. Moves them to shigoto_jobs_archive before deleting from the main table, then deletes archived rows older than the configured retention window so the archive stays bounded.

Per-queue gen_server that polls for available jobs and dispatches them to the executor supervisor. Supports graceful shutdown, queue weights, and pause/resume.

All SQL operations for Shigoto jobs. Uses FOR UPDATE SKIP LOCKED for safe multi-node job claiming.

Seki-based resilience integration for Shigoto workers.

Latency accelerator for delayed jobs. On a short interval it finds queues with work due to run now (a job's scheduled_at has elapsed, including a failed job rescheduled after its backoff) and issues a pg_notify('shigoto_jobs_insert', Queue) so the existing notifier wakes the matching queue immediately instead of waiting up to poll_interval.

Top-level supervisor for Shigoto. Starts the queue supervisor, cron scheduler, pruner, heartbeat, and optional LISTEN/NOTIFY notifier plus its due-job stager.

Telemetry events for Shigoto job lifecycle, queue operations, and resilience.

Test helpers for Shigoto: run workers with no database, and assert on the jobs your code enqueued.

Resolves IANA named time zones (e.g. <<"Europe/Stockholm">>) to their UTC offset at a specific instant, accounting for daylight saving time.

Behaviour for Shigoto job workers. Implement perform/1 to handle jobs.