(managementEndpoint, instanceId, remoteToken, next)
| 104 | } |
| 105 | |
| 106 | function pushStats(managementEndpoint, instanceId, remoteToken, next) { |
| 107 | if (process.env.PUSH_STATS === 'false') { |
| 108 | return; |
| 109 | } |
| 110 | |
| 111 | getStats((err, res, report) => { |
| 112 | if (err) { |
| 113 | logger.info('could not retrieve stats', { error: err }); |
| 114 | return; |
| 115 | } |
| 116 | |
| 117 | logger.debug('report', { report }); |
| 118 | postStats( |
| 119 | managementEndpoint, |
| 120 | instanceId, |
| 121 | remoteToken, |
| 122 | report, |
| 123 | next |
| 124 | ); |
| 125 | return; |
| 126 | }); |
| 127 | |
| 128 | setTimeout(pushStats, pushReportDelay, |
| 129 | managementEndpoint, instanceId, remoteToken); |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * Starts background task that updates configuration and pushes stats. |
no test coverage detected