Skip to content

Commit

Permalink
add bound tasks to event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
clriesco committed Dec 3, 2024
1 parent 5f68b77 commit fe52129
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/api/nvm-backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,17 @@ export class NVMBackendApi {

/**
* Handles the '_task-log' event from the websocket.
* Parses the incoming data, checks if it matches the bound tasks,
* retrieves the corresponding callback, executes it, and removes the callback if the task is completed or failed.
* Parses the incoming data, retrieves the corresponding callback,
* executes it, and removes the callback if the task is completed or failed.
*
* @param boundTasks - The tasks bound to this handler.
* @param boundTasks - The list of task IDs that the callback is bound to.
* @param data - The data received from the websocket event.
*/
private handleTaskLog(boundTasks: string[], data: any): void {
const parsedData = JSON.parse(data)
const { task_id: taskId } = parsedData

//Verify if the task is bound to this handler
// If the task ID is not in the list of bound tasks, ignore the event
if (!boundTasks.includes(taskId)) {
return
}
Expand Down

0 comments on commit fe52129

Please sign in to comment.