🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@fluojs/queue

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fluojs/queue - npm Package Compare versions

Comparing version
1.0.0-beta.4
to
1.0.0-beta.5
+2
-1
dist/service.d.ts
import type { Container } from '@fluojs/di';
import { type ApplicationLogger, type CompiledModule, type OnApplicationBootstrap, type OnApplicationShutdown, type OnModuleDestroy } from '@fluojs/runtime';
import type { ApplicationLogger, CompiledModule, OnApplicationBootstrap, OnApplicationShutdown, OnModuleDestroy } from '@fluojs/runtime';
import type { NormalizedQueueModuleOptions, Queue } from './types.js';

@@ -62,2 +62,3 @@ /**

private shutdown;
private waitForInFlightStartup;
private closeInitializedResources;

@@ -64,0 +65,0 @@ private tryCloseWorker;

@@ -1,1 +0,1 @@

{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACrB,MAAM,iBAAiB,CAAC;AASzB,OAAO,KAAK,EACV,4BAA4B,EAC5B,KAAK,EAIN,MAAM,YAAY,CAAC;AAkGpB;;;;;GAKG;AACH,qBACa,qBAAsB,YAAW,KAAK,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,eAAe;IAY/G,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAdzB,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAkD;IACvF,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAoC;IACpE,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CAAC,cAAc;YAQR,iBAAiB;YAOjB,yBAAyB;IAyBvC,OAAO,CAAC,mBAAmB;IAS3B,OAAO,CAAC,oBAAoB;IAa5B,OAAO,CAAC,mBAAmB;IAkB3B,OAAO,CAAC,0BAA0B;IAkBlC,OAAO,CAAC,0BAA0B;IASlC,OAAO,CAAC,yBAAyB;YASnB,kCAAkC;YAkBlC,qBAAqB;YAiBrB,aAAa;YAOb,oBAAoB;IAyBlC,OAAO,CAAC,sBAAsB;YAQhB,QAAQ;YAyBR,sBAAsB;YAgBtB,yBAAyB;YAqBzB,cAAc;YAQd,aAAa;YAQb,uBAAuB;CAOtC"}

@@ -107,2 +107,5 @@ let _initClass;

await this.ensureStarted();
if (this.lifecycleState !== 'started') {
throw new Error(`Queue lifecycle state is ${this.lifecycleState}.`);
}
const descriptor = this.descriptorsByJobType.get(job.constructor);

@@ -165,7 +168,11 @@ if (!descriptor) {

await this.initializeWorkers(redis);
this.lifecycleState = 'started';
if (this.lifecycleState === 'starting') {
this.lifecycleState = 'started';
}
}
async handleStartupFailure() {
await this.closeInitializedResources();
this.lifecycleState = 'idle';
if (this.lifecycleState === 'starting') {
this.lifecycleState = 'idle';
}
this.redisClient = undefined;

@@ -319,5 +326,7 @@ this.startPromise = undefined;

this.shutdownPromise = (async () => {
await this.waitForInFlightStartup();
await this.closeInitializedResources();
await this.deadLetterManager.drainPendingWrites();
this.lifecycleState = 'stopped';
this.redisClient = undefined;
this.startPromise = undefined;

@@ -327,2 +336,15 @@ })();

}
async waitForInFlightStartup() {
const startup = this.startPromise;
if (!startup) {
return;
}
try {
await startup;
} catch {
// ensureStarted() owns startup rollback and preserves the original
// bootstrap error. Shutdown still continues so partially registered
// resources cannot outlive the application lifecycle.
}
}
async closeInitializedResources() {

@@ -329,0 +351,0 @@ const workers = Array.from(this.workersByJobName.values());

@@ -13,3 +13,3 @@ {

],
"version": "1.0.0-beta.4",
"version": "1.0.0-beta.5",
"private": false,

@@ -42,6 +42,6 @@ "license": "MIT",

"bullmq": "^5.58.0",
"@fluojs/core": "^1.0.0-beta.4",
"@fluojs/di": "^1.0.0-beta.6",
"@fluojs/redis": "^1.0.0-beta.3",
"@fluojs/runtime": "^1.0.0-beta.11"
"@fluojs/core": "^1.0.0-beta.5",
"@fluojs/di": "^1.0.0-beta.7",
"@fluojs/redis": "^1.0.0-beta.4",
"@fluojs/runtime": "^1.0.0-beta.12"
},

@@ -48,0 +48,0 @@ "devDependencies": {

@@ -62,2 +62,11 @@ # @fluojs/queue

@Inject(QueueLifecycleService)
export class OrderService {
constructor(private readonly queue: QueueLifecycleService) {}
async placeOrder(id: string) {
await this.queue.enqueue(new ProcessOrderJob(id));
}
}
@Module({

@@ -68,14 +77,5 @@ imports: [

],
providers: [OrderWorker],
providers: [OrderService, OrderWorker],
})
export class AppModule {}
export class OrderService {
@Inject(QueueLifecycleService)
private readonly queue: QueueLifecycleService;
async placeOrder(id: string) {
await this.queue.enqueue(new ProcessOrderJob(id));
}
}
```

@@ -82,0 +82,0 @@

+10
-10

@@ -62,2 +62,11 @@ # @fluojs/queue

@Inject(QueueLifecycleService)
export class OrderService {
constructor(private readonly queue: QueueLifecycleService) {}
async placeOrder(id: string) {
await this.queue.enqueue(new ProcessOrderJob(id));
}
}
@Module({

@@ -68,14 +77,5 @@ imports: [

],
providers: [OrderWorker],
providers: [OrderService, OrderWorker],
})
export class AppModule {}
export class OrderService {
@Inject(QueueLifecycleService)
private readonly queue: QueueLifecycleService;
async placeOrder(id: string) {
await this.queue.enqueue(new ProcessOrderJob(id));
}
}
```

@@ -82,0 +82,0 @@