Skip to content

Commit

Permalink
Merge pull request #40 from golemfactory/feature/critical-error-event
Browse files Browse the repository at this point in the history
feat: critical error event in task executor
  • Loading branch information
mgordel authored Mar 13, 2024
2 parents 766b719 + 272b30e commit 36af5ee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export interface TaskExecutorEventsDict {
*/
beforeEnd: (timestamp: number) => void;

/**
* Fires when task executor encountered an unrecoverable error and is about to shut down.
*/
criticalError: (err: Error) => void;

/**
* Fires when task executor is completely terminated.
*/
Expand Down
1 change: 1 addition & 0 deletions src/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ export class TaskExecutor {
}

private handleCriticalError(err: Error) {
this.events.emit("criticalError", err);
const message =
"TaskExecutor faced a critical error and will now cancel work, terminate agreements and request settling payments";
this.logger.error(message, err);
Expand Down

0 comments on commit 36af5ee

Please sign in to comment.