report http-worker RPC errors to the main process for logging

This commit is contained in:
ansuz 2023-01-11 15:02:02 +05:30
parent 953c817c5b
commit 3f18a38714
1 changed files with 6 additions and 10 deletions

View File

@ -11,12 +11,7 @@ const DEFAULT_QUERY_TIMEOUT = 5000;
const PID = process.pid;
const response = Util.response(function (errLabel, info) {
// XXX handle error
console.error({
_: '// XXX',
errLabel: errLabel,
info: info,
});
Env.Log.error(errLabel, info);
});
const guid = () => {
@ -64,7 +59,7 @@ EVENTS.ENV_UPDATE = function (data /*, cb */) {
}
};
EVENTS.FLUSH_CACHE = function (data /*, cb */) { // XXX
EVENTS.FLUSH_CACHE = function (data) {
if (typeof(data) !== 'number') {
return Log.error('INVALID_FRESH_KEY', data);
}
@ -443,12 +438,13 @@ nThen(function (w) {
server.listen(3001, w()); // if (Env.httpSafePort) {...
}
server.on('upgrade', function (req, socket, head) {
//console.log("This should only happen in a dev environment"); // XXX
// TODO warn admins that websockets should only be proxied in this way in a dev environment
// in production it's more efficient to have your reverse proxy (NGINX) directly forward
// websocket traffic to the correct port (Env.websocketPort)
wsProxy.upgrade(req, socket, head);
});
}).nThen(function () {
// XXX inform the parent process that this worker is ready
// TODO inform the parent process that this worker is ready
});