Changed endpoint to an AWS one + added increased timeout

This commit is contained in:
askeluv
2019-03-15 15:52:32 +08:00
parent 70e550a25f
commit 6a9b71466d
2 changed files with 4 additions and 3 deletions

View File

@@ -2,7 +2,8 @@ import { fetchAsync } from '@0x/utils';
import Bottleneck from 'bottleneck';
const ONE_SECOND = 1000;
const EDPS_BASE_URL = 'http://35.185.219.196:1337';
const EDPS_BASE_URL = 'http://23.22.220.126:1337';
const TIMEOUT = 30 * ONE_SECOND;
export type EdpsResponse = EdpsWrapper[];
@@ -36,7 +37,7 @@ export class EdpsSource {
*/
public async getEdpsAsync(direction: string, symbol: string, amount: number): Promise<EdpsWrapper> {
const edpsUrl = `${EDPS_BASE_URL}/${direction}?amount=${amount}&symbol=${symbol}&decimals=`;
const resp = await this._limiter.schedule(() => fetchAsync(edpsUrl));
const resp = await this._limiter.schedule(() => fetchAsync(edpsUrl, {}, TIMEOUT));
const respJson: EdpsResponse = await resp.json();
const allExchanges: EdpsWrapper = {};
// The below unwraps the response so we get 1 single EdpsWrapper object

View File

@@ -13,7 +13,7 @@ import { handleError } from '../utils';
const BATCH_SAVE_SIZE = 1000;
// Max requests to make to API per second;
const EDPS_MAX_REQUESTS_PER_SECOND = 1;
const EDPS_MAX_REQUESTS_PER_SECOND = 0.5;
// Maximum requests per second to CryptoCompare
const CRYPTO_COMPARE_MAX_REQS_PER_SECOND = 60;