Registry / devops / tbs-cron-queue

tbs-cron-queue

JSON →
library0.1.6jsnpmunverified

NestJS module (v0.1.6) that distributes cron job execution across pods using Redis queues. Each pod checks the queue every 5 seconds and executes jobs via HTTP (axios). Provides APIs to add, clean, and manage cron jobs, plus a health check that returns 403 if the pod is busy. Requires @nestjs/common/core (>=6 <10) and ioredis (>=5.3.1). Limited to NestJS and blocking HTTP-based cron jobs.

npm install tbs-cron-queue
INSTALL
IMPORT
SIG · TBS-CRON-QUEUE
T
tbs-cron-queue
devopsjavascriptv0.1.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TbsCronQueueModule
import { TbsCronQueueModule } from 'tbs-cron-queue'
import TbsCronQueueModule from 'tbs-cron-queue'
Named export, not default.

Shows how to register the TbsCronQueueModule in a NestJS app module with Redis configuration and environment variables.

// app.module.ts import { Module } from '@nestjs/common'; import { TbsCronQueueModule } from 'tbs-cron-queue'; @Module({ imports: [ TbsCronQueueModule.register({ options: { port: +(process.env.REDIS_PORT ?? '6379'), host: process.env.REDIS_HOST ?? 'localhost', }, prefix: process.env.CRON_JOB_QUEUE_PREFIX ?? 'cron-queue', baseUrl: process.env.CRON_JOB_BASE_URL ?? 'http://localhost', site_config_prefix: process.env.KAFKA_TOPIC_PREFIX ?? '', }), ], }) export class AppModule {}
Debug
Known issues
gotchaPackage runs a background timer every 5s to pick jobs. This may cause unexpected load on Redis and the application if jobs overlap.
fix
Adjust your cron schedule to account for the 5s polling interval. Consider using a dedicated queue worker if higher throughput is needed.
affects: >=0.0.0
gotchaCron jobs are executed via internal HTTP calls (axios) to the baseUrl, requiring your cron endpoints to be idempotent and respond within a reasonable timeout.
fix
Ensure your cron APIs are HTTP reachable, stateless, and fast enough to avoid queue build-up.
affects: >=0.0.0
breakingPackage depends on peer deps @nestjs/common and @nestjs/core version >=6.0.0 <10.0.0. NestJS v10+ is not supported.
fix
Use NestJS v9 or earlier, or wait for a new package version.
affects: >=0.0.0
gotchaThe package also requires 'tbs-site-config' and 'global-body-validator-tbs' to be installed, though they are not listed as peer dependencies. Missing them may cause runtime errors.
fix
Install those packages as well: yarn add tbs-site-config global-body-validator-tbs
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'tbs-site-config' or its corresponding type declarations
Missing required dependency 'tbs-site-config'
fix
Run: yarn add tbs-site-config
TbsCronQueueModule.register is not a function
Incorrect import (default instead of named)
fix
Use: import { TbsCronQueueModule } from 'tbs-cron-queue'
ERR_INTERNAL_ASSERTION: Redis connection failed
Redis host/port environment variables not set or invalid
fix
Set REDIS_HOST and REDIS_PORT environment variables correctly.
Upgrade
Version history
0.1.6latest on npm
Audit
Dependencies
@nestjs/commonrequiredPeer dependency for NestJS module support
@nestjs/corerequiredPeer dependency for NestJS module support
ioredisrequiredPeer dependency for Redis client
Agent activity
9 hits · last 30 days
node
8
Resources
tbs-cron-queue — npm install tbs-cron-queue · libregistry