本文へ移動
cccskills
無料GitHub で公開

job-scheduling

Background jobs and scheduling for Educabot apps (Go/TS): BullMQ, asynq, cron, priority queues, retries, DLQ, graceful shutdown, observability.

日本語の概要は準備中です。原文の説明を表示しています。

SebastianLuser/claude-code-arcaneスター 3(GitHub 3 + cccskills 0)
連携ツールStripeKubernetesRedis

実行スコア 未検証

インストール方法を見る

含まれるファイル(1)

  • SKILL.md4.0 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

job-scheduling — Background Jobs & Scheduling

Educabot default: BullMQ (TS) and asynq (Go) on Redis. A DB separate from the cache.

When to use / NOT use

UseDo NOT use
Work that must not block HTTP (email, push, img)Synchronous operations <100ms
Expensive operations (exports, reports)Single-instance cron → k8s CronJob
Event fan-out, retry with backoffLarge data pipelines → Dataflow/Airflow
Scheduled (digest, cleanup, billing)Very light in-process queue → Go chan

Stack Decision

ToolStackWhen
BullMQTS/NodeTS default — mature, UI, scheduler
asynqGoGo default — clean API, flexible retry
RiverGo + PostgresEverything in PG, no Redis
TemporalMultiDurable long-running workflows
k8s CronJobAnySimple scheduled tasks with no deps

Architecture

Producer → Redis queue → Worker pod(s) → Success/Fail → retry/DLQ

Split queues by criticality: critical (auth, payments) / default (user-facing) / bulk (imports) / scheduled (cron). Separate worker pods per critical queue.

Retry Strategy

  • Attempts: 5 in general, 3 for expensive idempotent ones, 10 for flaky providers
  • Backoff: exponential, 30s base + ±25% jitter
  • Network errors/5xx/timeouts → retry. 4xx → NO retry, to the DLQ
  • BullMQ: UnrecoverableError to skip retries

Idempotency

  • jobId as the dedup key (BullMQ rejects it if it exists in waiting/active)
  • Idempotent logic: check the state before executing (if order.status === 'paid' return)
  • External effects: pass an Idempotency-Key to the provider (Stripe, SendGrid)

Rate Limiting Workers

  • BullMQ: limiter: { max: 100, duration: 1000 } on the Worker
  • Protects downstream (Stripe, OpenAI). Alt: a Redis token bucket before the call

Concurrency Control

  • Per job type: concurrency: N on the Worker
  • Per entity: Redis lock SET NX with a TTL → delay and requeue if locked

Graceful Shutdown

  • SIGTERM → worker.close() (stops taking jobs, waits for in-flight ones) → process.exit(0)
  • k8s: terminationGracePeriodSeconds: 60
  • Long jobs: design them to resume (persist progress in the DB)

Scheduled vs k8s CronJob

UseTool
App-aware cron that needs the worker poolBullMQ/asynq scheduler
Standalone cron scriptk8s CronJob (concurrencyPolicy: Forbid)
Durable multi-step workflowTemporal

Dead Letter & Dashboard

  • After exhausting retries: BullMQ → failed set, asynq → archived
  • Bull Board / asynqmon: waiting/active/completed/failed/delayed, manual retry
  • Alert: failed count/min > threshold → page on-call

Observability

  • Metrics: job_enqueued/completed/duration/retry_count, queue_depth{state}, worker_concurrency_active
  • Correlation ID: propagate traceId in the payload → the worker ties it to the trace
  • Dashboard: queue depth, duration p95, retry rate, failed count

Anti-patterns

  • Handler without idempotency, without graceful shutdown, a single queue for everything
  • Infinite retry, payload >MB in Redis (use a reference), secret in the payload
  • No DLQ, concurrency=100 without a rate limit, scheduled jobs on every pod without a lock
  • Logs without a correlation ID, removeOnComplete: true on important jobs

Checklist

  • Queue per criticality (critical/default/bulk)
  • Attempts + backoff + jitter configured
  • Idempotency (jobId + logic)
  • Reasonable per-job timeout
  • Graceful shutdown implemented
  • Rate limit if it calls external APIs
  • DLQ with an alert
  • Metrics + dashboard
  • Correlation ID in logs
  • Payload without PII/secrets

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

Plan, design, and implement A/B tests and experiments with statistical rigor. Covers hypothesis frameworks, sample sizing, metrics, and result analysis.

日本語の概要は準備中です。原文の説明を表示しています。

SebastianLuser/claude-code-arcane32026年10月29日 更新

Web/mobile accessibility decision guide: WCAG 2.2 AA, ARIA, keyboard nav, focus management, contrast, testing. Use for: a11y, accessibility, wcag, aria, screen reader, keyboard, contrast.

日本語の概要は準備中です。原文の説明を表示しています。

SebastianLuser/claude-code-arcane32026年10月29日 更新

Generate, iterate, and scale ad creative for paid advertising across Google, Meta, LinkedIn, and X. Covers platform specs, creative frameworks, and quality validation.

日本語の概要は準備中です。原文の説明を表示しています。

SebastianLuser/claude-code-arcane32026年10月29日 更新

Interactive music for games: vertical layering, horizontal re-sequencing, stingers, transition rules with sync points, and mapping gameplay states to music. Use for: adaptive music, dynamic music system, musical transitions, combat music.

日本語の概要は準備中です。原文の説明を表示しています。

SebastianLuser/claude-code-arcane32026年10月29日 更新

Design multi-agent systems, create agent architectures, define communication patterns, and build autonomous agent workflows with structured evaluation frameworks.

日本語の概要は準備中です。原文の説明を表示しています。

SebastianLuser/claude-code-arcane32026年10月29日 更新

Inter-agent communication protocol for C-suite agent teams. Defines invocation syntax, loop prevention, isolation rules, response formats, and quality loops.

日本語の概要は準備中です。原文の説明を表示しています。

SebastianLuser/claude-code-arcane32026年10月29日 更新

SebastianLuser のスキルをすべて見る

このスキルの問題を報告する