diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2017-12-14 07:05:57 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2017-12-14 07:05:57 +0800 |
commit | 6ba4ed99c42b4976902046625790698b490c3e0e (patch) | |
tree | 5b41b8911e12569f669fc7b30f3ea2cc19a33611 /packages/kovan-faucets/src | |
parent | aec3c8319159cf92d33b48e75327ee60bf4b29de (diff) | |
download | dexon-sol-tools-6ba4ed99c42b4976902046625790698b490c3e0e.tar dexon-sol-tools-6ba4ed99c42b4976902046625790698b490c3e0e.tar.gz dexon-sol-tools-6ba4ed99c42b4976902046625790698b490c3e0e.tar.bz2 dexon-sol-tools-6ba4ed99c42b4976902046625790698b490c3e0e.tar.lz dexon-sol-tools-6ba4ed99c42b4976902046625790698b490c3e0e.tar.xz dexon-sol-tools-6ba4ed99c42b4976902046625790698b490c3e0e.tar.zst dexon-sol-tools-6ba4ed99c42b4976902046625790698b490c3e0e.zip |
Fix hanging requests by importing web3 last
Diffstat (limited to 'packages/kovan-faucets/src')
-rw-r--r-- | packages/kovan-faucets/src/ts/handler.ts | 7 | ||||
-rw-r--r-- | packages/kovan-faucets/src/ts/request_queue.ts | 5 | ||||
-rw-r--r-- | packages/kovan-faucets/src/ts/zrx_request_queue.ts | 7 |
3 files changed, 17 insertions, 2 deletions
diff --git a/packages/kovan-faucets/src/ts/handler.ts b/packages/kovan-faucets/src/ts/handler.ts index d76a29514..1c6866a1c 100644 --- a/packages/kovan-faucets/src/ts/handler.ts +++ b/packages/kovan-faucets/src/ts/handler.ts @@ -1,6 +1,5 @@ import * as express from 'express'; import * as _ from 'lodash'; -import * as Web3 from 'web3'; import ProviderEngine = require('web3-provider-engine'); import HookedWalletSubprovider = require('web3-provider-engine/subproviders/hooked-wallet'); import NonceSubprovider = require('web3-provider-engine/subproviders/nonce-tracker'); @@ -12,6 +11,12 @@ import {idManagement} from './id_management'; import {utils} from './utils'; import {ZRXRequestQueue} from './zrx_request_queue'; +// HACK: web3 leaks XMLHttpRequest into the global scope and causes requests to hang +// because they are using the wrong XHR package. +// Issue: https://github.com/trufflesuite/truffle-contract/issues/14 +// tslint:disable-next-line:ordered-imports +import * as Web3 from 'web3'; + export class Handler { private etherRequestQueue: EtherRequestQueue; private zrxRequestQueue: ZRXRequestQueue; diff --git a/packages/kovan-faucets/src/ts/request_queue.ts b/packages/kovan-faucets/src/ts/request_queue.ts index 2a3fd4d03..0b5e66ae9 100644 --- a/packages/kovan-faucets/src/ts/request_queue.ts +++ b/packages/kovan-faucets/src/ts/request_queue.ts @@ -1,5 +1,10 @@ import * as _ from 'lodash'; import * as timers from 'timers'; + +// HACK: web3 leaks XMLHttpRequest into the global scope and causes requests to hang +// because they are using the wrong XHR package. +// Issue: https://github.com/trufflesuite/truffle-contract/issues/14 +// tslint:disable-next-line:ordered-imports import * as Web3 from 'web3'; const MAX_QUEUE_SIZE = 500; diff --git a/packages/kovan-faucets/src/ts/zrx_request_queue.ts b/packages/kovan-faucets/src/ts/zrx_request_queue.ts index 72500789c..6e6590e7c 100644 --- a/packages/kovan-faucets/src/ts/zrx_request_queue.ts +++ b/packages/kovan-faucets/src/ts/zrx_request_queue.ts @@ -2,13 +2,18 @@ import {ZeroEx} from '0x.js'; import {promisify} from '@0xproject/utils'; import BigNumber from 'bignumber.js'; import * as _ from 'lodash'; -import * as Web3 from 'web3'; import {configs} from './configs'; import {errorReporter} from './error_reporter'; import {RequestQueue} from './request_queue'; import {utils} from './utils'; +// HACK: web3 leaks XMLHttpRequest into the global scope and causes requests to hang +// because they are using the wrong XHR package. +// Issue: https://github.com/trufflesuite/truffle-contract/issues/14 +// tslint:disable-next-line:ordered-imports +import * as Web3 from 'web3'; + const DISPENSE_AMOUNT_ZRX = new BigNumber(0.1); const QUEUE_INTERVAL_MS = 5000; |