stanchionjs
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -32,3 +32,3 @@ "use strict"; | ||
} | ||
return Math.min(options.attempt * 100, 3000); | ||
return Math.min(options.attempt * 500, 3000); | ||
} }); | ||
@@ -35,0 +35,0 @@ const redis = Redis.createClient(finalRedisOptions); |
@@ -51,3 +51,5 @@ "use strict"; | ||
connection.onDisconnecting$().subscribe(() => { | ||
this.error$.next(new exception_1.DisconnectingError(`Connection disconnected.`)); | ||
if (this.shutdowned === false) { | ||
this.error$.next(new exception_1.DisconnectingError(`Connection disconnected.`)); | ||
} | ||
}); | ||
@@ -143,3 +145,4 @@ return connection; | ||
return rxjs_1.Observable.create((observer) => { | ||
let tickets = self.options.concurrency; | ||
const maxTicketCount = self.options.concurrency; | ||
let availableTicketCount = maxTicketCount; | ||
const buffer$ = new rxjs_1.Subject(); | ||
@@ -160,4 +163,4 @@ const done$ = new rxjs_1.Subject(); | ||
error: (err) => { | ||
self.error$.next(err); | ||
done$.next(); | ||
self.error$.next(err); | ||
}, | ||
@@ -169,3 +172,3 @@ }); | ||
const onDoneSub = done$.subscribe(() => { | ||
tickets++; | ||
availableTicketCount++; | ||
if (connection.redis.connected === true) { | ||
@@ -176,6 +179,6 @@ fetching$.next(); | ||
const onFetchingSub = fetching$.subscribe(() => { | ||
if (tickets <= 0) { | ||
if (availableTicketCount <= 0) { | ||
return void self.error$.next(new exception_1.UnexpectError(`over fetching`)); | ||
} | ||
tickets--; | ||
availableTicketCount--; | ||
blpop$(redisKey, 0).subscribe({ | ||
@@ -187,4 +190,4 @@ next: function unserializeJob([, serialized]) { | ||
catch (err) { | ||
self.error$.next(err); | ||
done$.next(); | ||
self.error$.next(err); | ||
} | ||
@@ -196,5 +199,2 @@ }, | ||
}, | ||
complete: () => { | ||
done$.next(); | ||
}, | ||
}); | ||
@@ -208,3 +208,3 @@ }); | ||
next: () => { | ||
rxjs_1.Observable.range(1, tickets).subscribe(() => fetching$.next()); | ||
rxjs_1.Observable.range(1, availableTicketCount).subscribe(() => fetching$.next()); | ||
}, | ||
@@ -220,3 +220,3 @@ error: (err) => { | ||
const onConnectionCuttedSub = connection.onCutted$() | ||
.filter(cutted => cutted === true) | ||
.filter(helper_1.isBoolean(true)) | ||
.subscribe(() => { | ||
@@ -223,0 +223,0 @@ const err = new Error(`connection cutted`); |
{ | ||
"name": "stanchionjs", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "A simple & fast queue done right. backed by Redis, supports auto-reconnect, TypeScript, Promise and Rxjs.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34189