aboutsummaryrefslogtreecommitdiffstats
path: root/packages/testnet-faucets/src/ts/request_queue.ts
diff options
context:
space:
mode:
authorBrandon Millman <brandon@0xproject.com>2018-02-01 06:55:50 +0800
committerGitHub <noreply@github.com>2018-02-01 06:55:50 +0800
commit6682abf89dcdf566f05f8d88cb6af06c4bb1f6a2 (patch)
tree5a7b3b1601cf34c14be2ba462f5fd2db711e1f2b /packages/testnet-faucets/src/ts/request_queue.ts
parent75539bf67537f202bc1075b096fd70f64705867e (diff)
parent78fbf0f7bade62a3d1c36bddf20cbe89c86aac18 (diff)
downloaddexon-0x-contracts-6682abf89dcdf566f05f8d88cb6af06c4bb1f6a2.tar.gz
dexon-0x-contracts-6682abf89dcdf566f05f8d88cb6af06c4bb1f6a2.tar.zst
dexon-0x-contracts-6682abf89dcdf566f05f8d88cb6af06c4bb1f6a2.zip
Merge pull request #354 from 0xProject/feature/tslint-config/underscore-protected-members
Modify lint rules to enforce underscore for protected members
Diffstat (limited to 'packages/testnet-faucets/src/ts/request_queue.ts')
-rw-r--r--packages/testnet-faucets/src/ts/request_queue.ts36
1 files changed, 18 insertions, 18 deletions
diff --git a/packages/testnet-faucets/src/ts/request_queue.ts b/packages/testnet-faucets/src/ts/request_queue.ts
index 20f2833a1..7d685522a 100644
--- a/packages/testnet-faucets/src/ts/request_queue.ts
+++ b/packages/testnet-faucets/src/ts/request_queue.ts
@@ -11,46 +11,46 @@ const MAX_QUEUE_SIZE = 500;
const DEFAULT_QUEUE_INTERVAL_MS = 1000;
export class RequestQueue {
- protected queueIntervalMs: number;
- protected queue: string[];
- protected queueIntervalId: NodeJS.Timer;
- protected web3: Web3;
+ protected _queueIntervalMs: number;
+ protected _queue: string[];
+ protected _queueIntervalId: NodeJS.Timer;
+ protected _web3: Web3;
constructor(web3: any) {
- this.queueIntervalMs = DEFAULT_QUEUE_INTERVAL_MS;
- this.queue = [];
+ this._queueIntervalMs = DEFAULT_QUEUE_INTERVAL_MS;
+ this._queue = [];
- this.web3 = web3;
+ this._web3 = web3;
- this.start();
+ this._start();
}
public add(recipientAddress: string): boolean {
if (this.isFull()) {
return false;
}
- this.queue.push(recipientAddress);
+ this._queue.push(recipientAddress);
return true;
}
public size(): number {
- return this.queue.length;
+ return this._queue.length;
}
public isFull(): boolean {
return this.size() >= MAX_QUEUE_SIZE;
}
- protected start() {
- this.queueIntervalId = timers.setInterval(() => {
- const recipientAddress = this.queue.shift();
+ protected _start() {
+ this._queueIntervalId = timers.setInterval(() => {
+ const recipientAddress = this._queue.shift();
if (_.isUndefined(recipientAddress)) {
return;
}
// tslint:disable-next-line:no-floating-promises
- this.processNextRequestFireAndForgetAsync(recipientAddress);
- }, this.queueIntervalMs);
+ this._processNextRequestFireAndForgetAsync(recipientAddress);
+ }, this._queueIntervalMs);
}
- protected stop() {
- clearInterval(this.queueIntervalId);
+ protected _stop() {
+ clearInterval(this._queueIntervalId);
}
// tslint:disable-next-line:prefer-function-over-method
- protected async processNextRequestFireAndForgetAsync(recipientAddress: string) {
+ protected async _processNextRequestFireAndForgetAsync(recipientAddress: string) {
throw new Error('Expected processNextRequestFireAndForgetAsync to be implemented by a subclass');
}
}