diff --git a/src/external/bot-skeleton/services/api/api-middleware.js b/src/external/bot-skeleton/services/api/api-middleware.js index 83eb3593..4d7cb02f 100644 --- a/src/external/bot-skeleton/services/api/api-middleware.js +++ b/src/external/bot-skeleton/services/api/api-middleware.js @@ -5,6 +5,7 @@ export const REQUESTS = [ 'buy', 'proposal', 'proposal_open_contract', + 'run_proposal_or_direct_buy', 'transaction', 'ticks_history', 'history', @@ -31,15 +32,35 @@ class APIMiddleware { if (res_type === 'history') { performance.mark('ticks_history_end'); measure = performance.measure('ticks_history', 'ticks_history_start', 'ticks_history_end'); + // eslint-disable-next-line no-console + console.table('ticks_history', measure.duration); } else { performance.mark(`${res_type}_end`); measure = performance.measure(`${res_type}`, `${res_type}_start`, `${res_type}_end`); + if (res_type === 'proposal') { + // eslint-disable-next-line no-console + console.table('proposal', measure.duration); + } } return (measure.startTimeDate = new Date(Date.now() - measure.startTime)); } return false; }; + sendWillBeCalled({ args: [request] }) { + const req_type = this.getRequestType(request); + let measure; + if (req_type === 'buy') { + performance.mark('first_proposal_or_run_end'); + if (performance.getEntriesByName('bot-start', 'mark').length) { + measure = performance.measure('run_proposal_or_direct_buy', 'bot-start', 'first_proposal_or_run_end'); + // eslint-disable-next-line no-console + console.table('measure', measure.duration); + performance.clearMarks('bot-start'); + } + } + } + sendIsCalled = ({ response_promise, args: [request] }) => { const req_type = this.getRequestType(request); if (req_type) performance.mark(`${req_type}_start`); diff --git a/src/stores/run-panel-store.ts b/src/stores/run-panel-store.ts index 50a51035..000f44bd 100644 --- a/src/stores/run-panel-store.ts +++ b/src/stores/run-panel-store.ts @@ -152,6 +152,7 @@ export default class RunPanelStore { let timer_counter = 1; if (window.sendRequestsStatistic) { performance.clearMeasures(); + performance.mark('bot-start'); // Log is sent every 10 seconds for 5 minutes this.timer = setInterval(() => { window.sendRequestsStatistic(true);