Add defaults
This commit is contained in:
parent
35668fe225
commit
a613c3b7e7
@ -12,7 +12,7 @@ import {intervalUtils} from '../utils/interval_utils';
|
|||||||
import {assert} from '../utils/assert';
|
import {assert} from '../utils/assert';
|
||||||
import {utils} from '../utils/utils';
|
import {utils} from '../utils/utils';
|
||||||
|
|
||||||
const DEFAULT_EVENT_POLLING_INTERVAL = 200;
|
const DEFAULT_EVENT_POLLING_INTERVAL_MS = 200;
|
||||||
|
|
||||||
enum LogEventState {
|
enum LogEventState {
|
||||||
Removed,
|
Removed,
|
||||||
@ -28,11 +28,11 @@ export class EventWatcher {
|
|||||||
private _pollingIntervalMs: number;
|
private _pollingIntervalMs: number;
|
||||||
private _intervalIdIfExists?: NodeJS.Timer;
|
private _intervalIdIfExists?: NodeJS.Timer;
|
||||||
private _lastEvents: Web3.LogEntry[] = [];
|
private _lastEvents: Web3.LogEntry[] = [];
|
||||||
constructor(web3Wrapper: Web3Wrapper, pollingIntervalMs: undefined|number) {
|
constructor(web3Wrapper: Web3Wrapper, pollingIntervalIfExistsMs: undefined|number) {
|
||||||
this._web3Wrapper = web3Wrapper;
|
this._web3Wrapper = web3Wrapper;
|
||||||
this._pollingIntervalMs = _.isUndefined(pollingIntervalMs) ?
|
this._pollingIntervalMs = _.isUndefined(pollingIntervalIfExistsMs) ?
|
||||||
DEFAULT_EVENT_POLLING_INTERVAL :
|
DEFAULT_EVENT_POLLING_INTERVAL_MS :
|
||||||
pollingIntervalMs;
|
pollingIntervalIfExistsMs;
|
||||||
}
|
}
|
||||||
public subscribe(callback: EventWatcherCallback): void {
|
public subscribe(callback: EventWatcherCallback): void {
|
||||||
assert.isFunction('callback', callback);
|
assert.isFunction('callback', callback);
|
||||||
|
@ -67,8 +67,8 @@ export class OrderStateWatcher {
|
|||||||
) {
|
) {
|
||||||
this._abiDecoder = abiDecoder;
|
this._abiDecoder = abiDecoder;
|
||||||
this._web3Wrapper = web3Wrapper;
|
this._web3Wrapper = web3Wrapper;
|
||||||
const eventPollingIntervalMs = _.isUndefined(config) ? undefined : config.eventPollingIntervalMs;
|
const pollingIntervalIfExistsMs = _.isUndefined(config) ? undefined : config.eventPollingIntervalMs;
|
||||||
this._eventWatcher = new EventWatcher(web3Wrapper, eventPollingIntervalMs);
|
this._eventWatcher = new EventWatcher(web3Wrapper, pollingIntervalIfExistsMs);
|
||||||
this._balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(token);
|
this._balanceAndProxyAllowanceLazyStore = new BalanceAndProxyAllowanceLazyStore(token);
|
||||||
this._orderFilledCancelledLazyStore = new OrderFilledCancelledLazyStore(exchange);
|
this._orderFilledCancelledLazyStore = new OrderFilledCancelledLazyStore(exchange);
|
||||||
this._orderStateUtils = new OrderStateUtils(
|
this._orderStateUtils = new OrderStateUtils(
|
||||||
|
@ -397,8 +397,8 @@ export interface JSONRPCPayload {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* orderExpirationCheckingIntervalMs: How often to check for expired orders
|
* orderExpirationCheckingIntervalMs: How often to check for expired orders. Default: 50
|
||||||
* eventPollingIntervalMs: How often to poll the Ethereum node for new events
|
* eventPollingIntervalMs: How often to poll the Ethereum node for new events. Defaults: 200
|
||||||
*/
|
*/
|
||||||
export interface OrderStateWatcherConfig {
|
export interface OrderStateWatcherConfig {
|
||||||
orderExpirationCheckingIntervalMs?: number;
|
orderExpirationCheckingIntervalMs?: number;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user