-
Notifications
You must be signed in to change notification settings - Fork 195
Closed
Description
I need to execute a fetch call after have finished a request, filtered with a njs body filter.
This call needs to pass the value of a variable that I've built with the filter, containing the amount of bytes passed with body.
I see that exists the njs.on(event, callback)
method, so into the header filter I'm testing this code:
njs.on('exit', () => {
ngx.fetch('https://www.google.com/robots.txt')
.then(reply => reply.text())
.then(text => r.warn(text.substring(0, 10)));
});
Anyway, instead of receive in logs the first chars of the robots file, I receive these errors:
2022/06/12 00:24:05 [notice] 1#1: signal 17 (SIGCHLD) received from 38
2022/06/12 00:24:05 [alert] 1#1: worker process 38 exited on signal 11
2022/06/12 00:24:05 [notice] 1#1: start worker process 55
2022/06/12 00:24:05 [notice] 1#1: signal 29 (SIGIO) received
Are asynchronous operation supported on this event? And if not, how could I perform this request? I'm not interested in result received by nginx, only that fetch is executed.