Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const sendSessionSummary = client => sessionCounts => {
const releaseStage = inferReleaseStage(client)
// exit early if the reports should not be sent on the current releaseStage
if (isArray(client.config.notifyReleaseStages) && !includes(client.config.notifyReleaseStages, releaseStage)) {
client._logger.warn(`Session not sent due to releaseStage/notifyReleaseStages configuration`)
return
}
if (!client.config.endpoints.sessions) {
client._logger.warn(`Session not sent due to missing endpoints.sessions configuration`)
return
}
if (!sessionCounts.length) return
const backoff = new Backoff({ min: 1000, max: 10000 })
const maxAttempts = 10
req(handleRes)
function handleRes (err) {
startSession: client => {
const sessionClient = client
sessionClient._session = new client.BugsnagSession()
const releaseStage = inferReleaseStage(sessionClient)
// exit early if the reports should not be sent on the current releaseStage
if (isArray(sessionClient.config.notifyReleaseStages) && !includes(sessionClient.config.notifyReleaseStages, releaseStage)) {
sessionClient._logger.warn(`Session not sent due to releaseStage/notifyReleaseStages configuration`)
return sessionClient
}
if (!sessionClient.config.endpoints.sessions) {
sessionClient._logger.warn(`Session not sent due to missing endpoints.sessions configuration`)
return sessionClient
}
sessionClient._delivery.sendSession({
notifier: sessionClient.notifier,
device: sessionClient.device,
app: { ...{ releaseStage }, ...sessionClient.app },
sessions: [
{
id: sessionClient._session.id,