From a874cd2424b5a42aed7bcf287dbd4314237e3522 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 5 Jul 2018 16:42:01 +0200 Subject: Remove legacy logic --- .../src/order_watcher/event_watcher.ts | 35 ---------------------- 1 file changed, 35 deletions(-) (limited to 'packages/order-watcher') diff --git a/packages/order-watcher/src/order_watcher/event_watcher.ts b/packages/order-watcher/src/order_watcher/event_watcher.ts index e14280421..9a4089384 100644 --- a/packages/order-watcher/src/order_watcher/event_watcher.ts +++ b/packages/order-watcher/src/order_watcher/event_watcher.ts @@ -52,15 +52,6 @@ export class EventWatcher { throw new Error(OrderWatcherError.SubscriptionAlreadyPresent); } this._startBlockAndLogStream(callback); - // TODO: IS the above the correct refactor of this? - // this._intervalIdIfExists = intervalUtils.setAsyncExcludingInterval( - // this._pollForBlockchainEventsAsync.bind(this, callback), - // this._pollingIntervalMs, - // (err: Error) => { - // this.unsubscribe(); - // callback(err); - // }, - // ); } public unsubscribe(): void { if (!_.isUndefined(this._blockAndLogStreamIntervalIfExists)) { @@ -113,32 +104,6 @@ export class EventWatcher { await this._blockAndLogStreamerIfExists.reconcileNewBlock((latestBlock as any) as Block); } } - // private async _pollForBlockchainEventsAsync(callback: EventWatcherCallback): Promise { - // const pendingEvents = await this._getEventsAsync(); - // if (_.isUndefined(pendingEvents)) { - // // HACK: This should never happen, but happens frequently on CI due to a ganache bug - // return; - // } - // if (pendingEvents.length === 0) { - // // HACK: Sometimes when node rebuilds the pending block we get back the empty result. - // // We don't want to emit a lot of removal events and bring them back after a couple of miliseconds, - // // that's why we just ignore those cases. - // return; - // } - // const removedEvents = _.differenceBy(this._lastEvents, pendingEvents, JSON.stringify); - // const newEvents = _.differenceBy(pendingEvents, this._lastEvents, JSON.stringify); - // await this._emitDifferencesAsync(removedEvents, LogEventState.Removed, callback); - // await this._emitDifferencesAsync(newEvents, LogEventState.Added, callback); - // this._lastEvents = pendingEvents; - // } - // private async _getEventsAsync(): Promise { - // const eventFilter = { - // fromBlock: this._stateLayer, - // toBlock: this._stateLayer, - // }; - // const events = await this._web3Wrapper.getLogsAsync(eventFilter); - // return events; - // } private async _emitDifferencesAsync( log: LogEntry, logEventState: LogEventState, -- cgit