Called when starting saffron.
Called when stopping saffron.
Called when all the sources are loaded. Passes one argument, which is the source's names.
Called when the scheduler pushes a new source scrapping job at the stack. Passes one argument, which is the job instance.
Called when the scheduler finds a finished source scrapping job at the stack. Passes one argument, which is the job instance.
Called when the scheduler finds a failed source scrapping job at the stack. Passes one argument, which is the job instance.
Called a little after scheduler.job.failed
event after the job has
been pushed back to the list.
Passes one argument, which is the job instance.
Called when replacing a worker for a specific job Passes two argument, which is oldWorkerId and the job instance with the updated worker.
Called when the scheduler finds a job ready to run and pushes it to the workers. Passes one argument, which is the job instance.
Called when grid is online, for main
node when server is running and for worker
node when
it connected to the server.
Called when a new node is connected to the Grid. Passes one argument, which is the socket instance.
Called when a node disconnects from the Grid. Passes one argument, which is the socket instance.
Called when a worker is available to take source scrapping jobs. Passes one argument, which is the worker's id.
Called when a worker stops receiving source scrapping jobs. Passes one argument, which is the worker's id.
Called when a wroker
node tries to connect with invalid authentication token.
Passes one argument, which is the socket instance.
Called when a worker finishes a job. Passes one argument, which is the job's id.
Called after worker.job.finished
.
Passes two arguments, which is the articles that where found and the table name.
Called when the scheduler failed to load a source file or reading the source file directory. Passes two arguments, which is the source file and the error instance.
Called when the connection with the main
node fails.
Passes one argument, which is the reason it failed.
Called when a worker fails a job. Passes one argument, which is the job's id.
Called when a parser fails a job. Passes one argument, which is the error instance.
Called when an unhandled error is thrown at a middleware function. Passes two arguments, which is the middleware name and the error instance.
Called before middlewares are applied. Passes one argument, which is the articles array.
Called after middlewares are applied. Passes one argument, which is the modified articles array.
To catch all the events:
saffron.on("*", (eventName, ...args) => {
// ...
console.log(args)
});