
Security News
Opengrep Adds Apex Support and New Rule Controls in Latest Updates
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
@penkov/tasks_queue
Advanced tools
A lightweight PostgreSQL-backed task queue system with scheduling, retries, backoff strategies, and priority handling. Designed for efficiency and observability in modern Node.js applications.
@penkov/tasks_queue is a lightweight, PostgreSQL-backed task queue system designed for:
start_after
)backoff
max_attempts
)priority
)repeat_type
)It’s built for efficiency and flexibility in modern Node.js
applications, and works seamlessly with NestJS
.
npm install @penkov/tasks_queue
Install peer dependencies if not already present:
npm install pg tslib application-metrics log4js scats
For NestJS integration:
npm install @nestjs/common @nestjs/core
Apply migration.sql on your db, or add a new migration file to your migrations.
Register the queue module in your app. You have to provide pg.Pool
import { Module } from '@nestjs/common';
import { TasksQueueModule } from 'tasks_queue';
@Module({
imports: [
TasksQueueModule.forRootAsync({
inject: [pg.Pool],
useFactory: (db: pg.Pool) => ({
db: db,
pools: [
{
name: DEFAULT_POOL,
loopInterval: TimeUtils.minute,
concurrency: 2
},
{
name: 'preview',
loopInterval: TimeUtils.minute,
concurrency: 5
},
]
})
}),
],
})
export class AppModule {}
Create a worker and register a task handler:
@Injectable()
export class GeneratePreviewTaskWorker extends TasksWorker implements OnApplicationBootstrap {
static readonly QUEUE_NAME = 'generate-preview';
constructor(
@Inject(STORAGE_CONFIG) private readonly storageConf: StorageConfig,
private readonly offeredServiceImagesDao: OfferedServiceImagesDao,
private readonly tasksQueueService: TasksPoolsService
) {
super();
}
async onApplicationBootstrap() {
this.tasksQueueService.registerWorker(GeneratePreviewTaskWorker.QUEUE_NAME, this, 'preview');
}
async process(payload: any): Promise<void> {
const imageId = payload['imageId'] as number;
// ...
}
}
Submit tasks:
private readonly tasks: TasksPoolsService,
//...
await this.tasks.schedule({
queue: GeneratePreviewTaskWorker.QUEUE_NAME,
payload: { imageId: imageId }
});
FAQs
A lightweight PostgreSQL-backed task queue system with scheduling, retries, backoff strategies, and priority handling. Designed for efficiency and observability in modern Node.js applications.
The npm package @penkov/tasks_queue receives a total of 117 weekly downloads. As such, @penkov/tasks_queue popularity was classified as not popular.
We found that @penkov/tasks_queue demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.