mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
format
This commit is contained in:
parent
2731fd7b4e
commit
79b8ecc98f
@ -21,7 +21,9 @@ export default class TasksQueue extends Core {
|
||||
|
||||
processTasks() {
|
||||
if (this.runningTasksIds.length >= TasksQueue.maxRunningTasks ?? 1) {
|
||||
this.console.log("We are already running the maximum number of tasks")
|
||||
this.console.log(
|
||||
"We are already running the maximum number of tasks",
|
||||
)
|
||||
return false
|
||||
}
|
||||
|
||||
@ -47,17 +49,20 @@ export default class TasksQueue extends Core {
|
||||
// add the task to the running tasks array
|
||||
this.runningTasksIds.push(task.id)
|
||||
|
||||
const taskResult = await task.fn()
|
||||
.catch((error) => {
|
||||
const taskResult = await task.fn().catch((error) => {
|
||||
// delete the task from the running tasks array
|
||||
this.runningTasksIds = this.runningTasksIds.filter((runningTaskId) => runningTaskId !== task.id)
|
||||
this.runningTasksIds = this.runningTasksIds.filter(
|
||||
(runningTaskId) => runningTaskId !== task.id,
|
||||
)
|
||||
|
||||
// propagate the error through an exception
|
||||
throw error
|
||||
})
|
||||
|
||||
// delete the task from the running tasks array
|
||||
this.runningTasksIds = this.runningTasksIds.filter((runningTaskId) => runningTaskId !== task.id)
|
||||
this.runningTasksIds = this.runningTasksIds.filter(
|
||||
(runningTaskId) => runningTaskId !== task.id,
|
||||
)
|
||||
|
||||
return taskResult
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user