Skip to content

Commit

Permalink
Reduce error log frequency
Browse files Browse the repository at this point in the history
  • Loading branch information
AshakaE committed Jul 31, 2024
1 parent 56d3767 commit 2e24fbf
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/services/wikiUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export default class WikiUpdates {
errorCode: string,
env: ChannelTypes,
) {

const errorEmbed = new MessageEmbed()
.setColor('#ff0000')
.setTitle(`⚠️ Request to ${env} API failed ⚠️`)
Expand All @@ -70,9 +69,7 @@ export default class WikiUpdates {
const channel = client.channels.cache.get(id) as TextChannel
if (count % notifyCount === 0) {
channel.send({
embeds: [
await this.messageApiErrorStyle(link, errorCode, channelType),
],
embeds: [await this.messageApiErrorStyle(link, errorCode, channelType)],
})
}
}
Expand Down Expand Up @@ -152,7 +149,9 @@ export default class WikiUpdates {
return apiCall
} catch (e: any) {
if (e) {
await this.notifyError(count, channelType, link, e.code)
if (count >= 5) {
await this.notifyError(count, channelType, link, e.code)
}
console.error(
`Error code ${e.code}: API Request to ${link} failed. Retrying in ${
retryTime / 1000
Expand Down

0 comments on commit 2e24fbf

Please sign in to comment.