Couple of Sentry cleanups (#8532)
* Temp ignore a couple logs * Add debug for unknown notifications * Nvm let's do this in Sentry * Downgrade two DMs network related issues * Check for network errors before sending in Convo * Do the same for event bus * Fix mistake
This commit is contained in:
@@ -3,6 +3,7 @@ import EventEmitter from 'eventemitter3'
|
||||
import {nanoid} from 'nanoid/non-secure'
|
||||
|
||||
import {networkRetry} from '#/lib/async/retry'
|
||||
import {isNetworkError} from '#/lib/strings/errors'
|
||||
import {Logger} from '#/logger'
|
||||
import {
|
||||
BACKGROUND_POLL_INTERVAL,
|
||||
@@ -18,7 +19,6 @@ import {
|
||||
} from '#/state/messages/events/types'
|
||||
import {DM_SERVICE_HEADERS} from '#/state/queries/messages/const'
|
||||
|
||||
const LOGGER_CONTEXT = 'MessagesEventBus'
|
||||
const logger = Logger.create(Logger.Context.DMsAgent)
|
||||
|
||||
export class MessagesEventBus {
|
||||
@@ -91,17 +91,17 @@ export class MessagesEventBus {
|
||||
}
|
||||
|
||||
background() {
|
||||
logger.debug(`${LOGGER_CONTEXT}: background`, {})
|
||||
logger.debug(`background`, {})
|
||||
this.dispatch({event: MessagesEventBusDispatchEvent.Background})
|
||||
}
|
||||
|
||||
suspend() {
|
||||
logger.debug(`${LOGGER_CONTEXT}: suspend`, {})
|
||||
logger.debug(`suspend`, {})
|
||||
this.dispatch({event: MessagesEventBusDispatchEvent.Suspend})
|
||||
}
|
||||
|
||||
resume() {
|
||||
logger.debug(`${LOGGER_CONTEXT}: resume`, {})
|
||||
logger.debug(`resume`, {})
|
||||
this.dispatch({event: MessagesEventBusDispatchEvent.Resume})
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ export class MessagesEventBus {
|
||||
break
|
||||
}
|
||||
|
||||
logger.debug(`${LOGGER_CONTEXT}: dispatch '${action.event}'`, {
|
||||
logger.debug(`dispatch '${action.event}'`, {
|
||||
id: this.id,
|
||||
prev: prevStatus,
|
||||
next: this.status,
|
||||
@@ -236,7 +236,7 @@ export class MessagesEventBus {
|
||||
}
|
||||
|
||||
private async init() {
|
||||
logger.debug(`${LOGGER_CONTEXT}: init`, {})
|
||||
logger.debug(`init`, {})
|
||||
|
||||
try {
|
||||
const response = await networkRetry(2, () => {
|
||||
@@ -260,9 +260,11 @@ export class MessagesEventBus {
|
||||
|
||||
this.dispatch({event: MessagesEventBusDispatchEvent.Ready})
|
||||
} catch (e: any) {
|
||||
logger.error(e, {
|
||||
message: `${LOGGER_CONTEXT}: init failed`,
|
||||
})
|
||||
if (!isNetworkError(e)) {
|
||||
logger.error(`init failed`, {
|
||||
safeMessage: e.message,
|
||||
})
|
||||
}
|
||||
|
||||
this.dispatch({
|
||||
event: MessagesEventBusDispatchEvent.Error,
|
||||
@@ -324,7 +326,7 @@ export class MessagesEventBus {
|
||||
this.isPolling = true
|
||||
|
||||
// logger.debug(
|
||||
// `${LOGGER_CONTEXT}: poll`,
|
||||
// `poll`,
|
||||
// {
|
||||
// requestedPollIntervals: Array.from(
|
||||
// this.requestedPollIntervals.values(),
|
||||
@@ -370,16 +372,14 @@ export class MessagesEventBus {
|
||||
}
|
||||
|
||||
if (needsEmit) {
|
||||
try {
|
||||
this.emitter.emit('event', {type: 'logs', logs: batch})
|
||||
} catch (e: any) {
|
||||
logger.error(e, {
|
||||
message: `${LOGGER_CONTEXT}: process latest events`,
|
||||
})
|
||||
}
|
||||
this.emitter.emit('event', {type: 'logs', logs: batch})
|
||||
}
|
||||
} catch (e: any) {
|
||||
logger.error(e, {message: `${LOGGER_CONTEXT}: poll events failed`})
|
||||
if (!isNetworkError(e)) {
|
||||
logger.error(`poll events failed`, {
|
||||
safeMessage: e.message,
|
||||
})
|
||||
}
|
||||
|
||||
this.dispatch({
|
||||
event: MessagesEventBusDispatchEvent.Error,
|
||||
|
||||
Reference in New Issue
Block a user