Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
node_modules/
test.js
.DS_Store
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
8 changes: 5 additions & 3 deletions es5.js
Original file line number Diff line number Diff line change
Expand Up @@ -1786,7 +1786,11 @@

var base;

if (this.heartbeat == null && (this.storeOptions.reservoirRefreshInterval != null && this.storeOptions.reservoirRefreshAmount != null || this.storeOptions.reservoirIncreaseInterval != null && this.storeOptions.reservoirIncreaseAmount != null)) {
if (this.heartbeat != null) {
clearInterval(this.heartbeat);
}

if (this.storeOptions.reservoirRefreshInterval != null && this.storeOptions.reservoirRefreshAmount != null || this.storeOptions.reservoirIncreaseInterval != null && this.storeOptions.reservoirIncreaseAmount != null) {
return typeof (base = this.heartbeat = setInterval(function () {
var amount, incr, maximum, now, reservoir;
now = Date.now();
Expand All @@ -1812,8 +1816,6 @@
}
}
}, this.heartbeatInterval)).unref === "function" ? base.unref() : void 0;
} else {
return clearInterval(this.heartbeat);
}
}
}, {
Expand Down
8 changes: 5 additions & 3 deletions lib/LocalDatastore.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ LocalDatastore = class LocalDatastore {
_startHeartbeat() {
var base;

if (this.heartbeat == null && (this.storeOptions.reservoirRefreshInterval != null && this.storeOptions.reservoirRefreshAmount != null || this.storeOptions.reservoirIncreaseInterval != null && this.storeOptions.reservoirIncreaseAmount != null)) {
if (this.heartbeat != null) {
clearInterval(this.heartbeat);
}

if (this.storeOptions.reservoirRefreshInterval != null && this.storeOptions.reservoirRefreshAmount != null || this.storeOptions.reservoirIncreaseInterval != null && this.storeOptions.reservoirIncreaseAmount != null) {
return typeof (base = this.heartbeat = setInterval(() => {
var amount, incr, maximum, now, reservoir;
now = Date.now();
Expand All @@ -52,8 +56,6 @@ LocalDatastore = class LocalDatastore {
}
}
}, this.heartbeatInterval)).unref === "function" ? base.unref() : void 0;
} else {
return clearInterval(this.heartbeat);
}
}

Expand Down
4 changes: 2 additions & 2 deletions light.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ declare module "bottleneck/light" {
/**
* The Redis TTL in milliseconds for the keys created by the limiter. When `timeout` is set, the limiter's state will be automatically removed from Redis after timeout milliseconds of inactivity. Note: timeout is 300000 (5 minutes) by default when using a Group.
*/
readonly timeout?: number | null;
readonly timeout?: number | null;
/**
* Every `heartbeatInterval` milliseconds, the `reservoir` is assessed.
*/
Expand Down Expand Up @@ -542,7 +542,7 @@ class Bottleneck {
* Changes the settings for future requests.
* @param options - The new settings.
*/
updateSettings(options?: Bottleneck.ConstructorOptions): Bottleneck;
updateSettings(options?: Bottleneck.ConstructorOptions): Promise<Bottleneck>;

/**
* Adds to the reservoir count and returns the new value.
Expand Down
7 changes: 4 additions & 3 deletions light.js
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,10 @@

_startHeartbeat() {
var base;
if ((this.heartbeat == null) && (((this.storeOptions.reservoirRefreshInterval != null) && (this.storeOptions.reservoirRefreshAmount != null)) || ((this.storeOptions.reservoirIncreaseInterval != null) && (this.storeOptions.reservoirIncreaseAmount != null)))) {
if (this.heartbeat != null) {
clearInterval(this.heartbeat);
}
if (((this.storeOptions.reservoirRefreshInterval != null) && (this.storeOptions.reservoirRefreshAmount != null)) || ((this.storeOptions.reservoirIncreaseInterval != null) && (this.storeOptions.reservoirIncreaseAmount != null))) {
return typeof (base = (this.heartbeat = setInterval(() => {
var amount, incr, maximum, now, reservoir;
now = Date.now();
Expand All @@ -500,8 +503,6 @@
}
}
}, this.heartbeatInterval))).unref === "function" ? base.unref() : void 0;
} else {
return clearInterval(this.heartbeat);
}
}

Expand Down
Loading