
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
nest-schedule-bull
Advanced tools
A NestJS module for scheduling Bull jobs using cron expressions
npm install nest-schedule-bull
Modern applications often require reliable and efficient job scheduling to automate repetitive tasks, manage background processes, and enhance overall system performance. Nest Schedule Bull is motivated by the need for a flexible and scalable solution that seamlessly integrates with NestJS and leverages the robust capabilities of the Bull job queue.
Benefits over @nestjs/schedule
First you need to import the module in your app.module.ts
file:
import { Module } from "@nestjs/common";
import { ScheduleBullModule } from "nest-schedule-bull";
@Module({
imports: [
ScheduleBullModule.forRoot({
connection: {
url: "redis://localhost:6379",
},
queueName: "crons", // Optional
}),
],
})
export class AppModule {}
Then you can use the @Cron()
decorator to schedule your jobs:
import { Injectable, Logger } from "@nestjs/common";
import { Cron, CronExpression } from "nest-schedule-bull";
@Injectable()
export class AppService {
private logger = new Logger(AppService.name);
@Cron(CronExpression.EVERY_10_SECONDS)
public async doSomething(): Promise<void> {
this.logger.log("Doing something...");
}
}
If you need check the status of your jobs, you can use the following decorators:
import { Injectable, Logger } from "@nestjs/common";
import {
Cron,
CronExpression,
OnQueueActive,
OnQueueCompleted,
OnQueueError,
OnQueueFailed,
OnQueueProgress,
} from "nest-schedule-bull";
@Injectable()
export class AppService {
private logger = new Logger(AppService.name);
@Cron(CronExpression.EVERY_10_SECONDS)
public async doSomething(): Promise<void> {
this.logger.log("Doing something...");
}
@OnQueueActive()
public onActive(job: Job): void {
this.logger.log(`Job ${job.id} is active`);
}
@OnQueueCompleted()
public onCompleted(job: Job): void {
this.logger.log(`Job ${job.id} is completed`);
}
@OnQueueError()
public onError(job: Job, error: Error): void {
this.logger.log(`Job ${job.id} has failed with error ${error.message}`);
}
@OnQueueFailed()
public onFailed(job: Job, error: Error): void {
this.logger.log(`Job ${job.id} has failed with error ${error.message}`);
}
@OnQueueProgress()
public onProgress(job: Job): void {
this.logger.log(`Job ${job.id} is ${job.progress}% done`);
}
}
nest-schedule-bull
is MIT licensed.
FAQs
A NestJS module for scheduling Bull jobs using cron expressions
The npm package nest-schedule-bull receives a total of 3 weekly downloads. As such, nest-schedule-bull popularity was classified as not popular.
We found that nest-schedule-bull demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.