(options)
| 115 | } |
| 116 | |
| 117 | function pushStats(options) { |
| 118 | if (process.env.PUSH_STATS === 'false') { |
| 119 | return; |
| 120 | } |
| 121 | const fromURL = `http://${cloudServerHost}:${cloudServerPort}/_/report`; |
| 122 | const fromOptions = { |
| 123 | json: true, |
| 124 | headers: { |
| 125 | 'x-scal-report-token': process.env.REPORT_TOKEN, |
| 126 | 'x-scal-report-skip-cache': Boolean(options && options.noCache), |
| 127 | }, |
| 128 | }; |
| 129 | request.get(fromURL, fromOptions, (err, response, body) => { |
| 130 | if (err) { |
| 131 | _logError(err, 'failed to get metrics report', 'pushStats'); |
| 132 | return; |
| 133 | } |
| 134 | ws.send(ChannelMessageV0.encodeMetricsReportMessage(body), |
| 135 | err => _logError(err, 'failed to send metrics report message', |
| 136 | 'pushStats')); |
| 137 | }); |
| 138 | } |
| 139 | |
| 140 | function closeChannel(channelId) { |
| 141 | const socket = socketsByChannelId[channelId]; |
no test coverage detected