Skip to content

Commit

Permalink
chore: logging tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
thaaddeus committed Feb 11, 2022
1 parent 0a89840 commit b6b04d9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/minion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,19 @@ class Minion {
const message = `Too many requests, slow down. Current limit: ${this.MAX_MESSAGES_PER_SECOND} messages per second.`
logger.log('info', message, meta)

logger.log('info', message, {
clientIP: ws.getRemoteAddressAsText(),
...meta
})

const errorMessage: ErrorResponse = {
type: 'error',
message,
timestamp: new Date().toISOString()
}

await wait(3000)

await this._send(ws, () => JSON.stringify(errorMessage))

return
Expand Down

0 comments on commit b6b04d9

Please sign in to comment.