mirror of https://github.com/Chocobozzz/PeerTube
Catch metrics error
parent
34023e1253
commit
89fc014262
|
@ -1,6 +1,7 @@
|
||||||
import videojs from 'video.js'
|
import videojs from 'video.js'
|
||||||
import { PlaybackMetricCreate } from '../../../../../../shared/models'
|
import { PlaybackMetricCreate } from '../../../../../../shared/models'
|
||||||
import { MetricsPluginOptions, PlayerMode, PlayerNetworkInfo } from '../../types'
|
import { MetricsPluginOptions, PlayerMode, PlayerNetworkInfo } from '../../types'
|
||||||
|
import { logger } from '@root-helpers/logger'
|
||||||
|
|
||||||
const Plugin = videojs.getPlugin('plugin')
|
const Plugin = videojs.getPlugin('plugin')
|
||||||
|
|
||||||
|
@ -99,6 +100,7 @@ class MetricsPlugin extends Plugin {
|
||||||
const headers = new Headers({ 'Content-type': 'application/json; charset=UTF-8' })
|
const headers = new Headers({ 'Content-type': 'application/json; charset=UTF-8' })
|
||||||
|
|
||||||
return fetch(this.metricsUrl, { method: 'POST', body: JSON.stringify(body), headers })
|
return fetch(this.metricsUrl, { method: 'POST', body: JSON.stringify(body), headers })
|
||||||
|
.catch(err => logger.error('Cannot send metrics to the server.', err))
|
||||||
}, this.CONSTANTS.METRICS_INTERVAL)
|
}, this.CONSTANTS.METRICS_INTERVAL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue