Skip to content

Commit

Permalink
refactor: don't show error when message isn't sent
Browse files Browse the repository at this point in the history
  • Loading branch information
sockmaster27 committed Aug 21, 2024
1 parent a1ea7e0 commit 361de38
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions server/src/engine/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,22 +148,7 @@ export async function closeSocket() {
}
}

export function sendMessage(job: jobs.EnqueuedJob, expectResponse = true, retries = 0) {
if (isClosed()) {
if (retries > 2) {
const errorMessage = USER_MESSAGE.REQUEST_TIMEOUT(retries)
sendNotification(jobs.Request.internalError, {
message: errorMessage,
actions: [],
})
return
}
setTimeout(() => {
sendMessage(job, expectResponse, retries + 1)
}, 1000)
return
}

export function sendMessage(job: jobs.EnqueuedJob, expectResponse = true) {
if (expectResponse) {
// register a timer to handle timeouts
sentMessagesMap[job.id] = setTimeout(() => {
Expand Down

0 comments on commit 361de38

Please sign in to comment.