Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve log message for queue* hooks #3349

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
- avg: repackaged as NPM module #3347
- bounce: repackaged plugin as NPM module #3341
- connection: check remote is connected before queue #3338
- improve log message for queue* hooks, fixes #2998
- support IPv6 when setting remote.is_private #3295
- in setTLS, replace forEach with for...of
- NOTE: remove a handful of 3.0 sunset property names #3315
Expand Down
11 changes: 8 additions & 3 deletions connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
self.fail();
});

self.client.on('close', has_error => {

Check warning on line 173 in connection.js

View workflow job for this annotation

GitHub Actions / lint / lint

'has_error' is defined but never used

Check warning on line 173 in connection.js

View workflow job for this annotation

GitHub Actions / lint / lint

'has_error' is defined but never used
if (self.state >= states.DISCONNECTING) return;
self.remote.closed = true;
self.loginfo('client dropped connection', log_data);
Expand Down Expand Up @@ -202,7 +202,7 @@

const ha_list = net.isIPv6(self.remote.ip) ? haproxy_hosts_ipv6 : haproxy_hosts_ipv4;

if (ha_list.some((element, index, array) => {

Check warning on line 205 in connection.js

View workflow job for this annotation

GitHub Actions / lint / lint

'index' is defined but never used

Check warning on line 205 in connection.js

View workflow job for this annotation

GitHub Actions / lint / lint

'array' is defined but never used

Check warning on line 205 in connection.js

View workflow job for this annotation

GitHub Actions / lint / lint

'index' is defined but never used

Check warning on line 205 in connection.js

View workflow job for this annotation

GitHub Actions / lint / lint

'array' is defined but never used
return ipaddr.parse(self.remote.ip).match(element[0], element[1]);
})) {
self.proxy.allowed = true;
Expand Down Expand Up @@ -686,7 +686,7 @@
}
/////////////////////////////////////////////////////////////////////////////
// SMTP Responses
connect_init_respond (retval, msg) {

Check warning on line 689 in connection.js

View workflow job for this annotation

GitHub Actions / lint / lint

'retval' is defined but never used

Check warning on line 689 in connection.js

View workflow job for this annotation

GitHub Actions / lint / lint

'msg' is defined but never used

Check warning on line 689 in connection.js

View workflow job for this annotation

GitHub Actions / lint / lint

'retval' is defined but never used

Check warning on line 689 in connection.js

View workflow job for this annotation

GitHub Actions / lint / lint

'msg' is defined but never used
// retval and message are ignored
this.logdebug('running connect_init_respond');
plugins.run_hooks('lookup_rdns', this);
Expand Down Expand Up @@ -902,7 +902,7 @@
}
}
}
capabilities_respond (retval, msg) {

Check warning on line 905 in connection.js

View workflow job for this annotation

GitHub Actions / lint / lint

'retval' is defined but never used

Check warning on line 905 in connection.js

View workflow job for this annotation

GitHub Actions / lint / lint

'retval' is defined but never used
this.respond(250, this.capabilities);
}
quit_respond (retval, msg) {
Expand Down Expand Up @@ -1701,7 +1701,12 @@
});
}
queue_msg (retval, msg) {
if (msg) return msg;
if (msg) {
if (typeof msg === 'object' && msg.constructor.name === 'DSN') {
return msg.reply
}
return msg;
}

switch (retval) {
case constants.ok:
Expand Down Expand Up @@ -1737,7 +1742,7 @@
}
queue_outbound_respond (retval, msg) {
if (this.remote.closed) return;
if (!msg) msg = this.queue_msg(retval, msg) || 'Message Queued';
msg = this.queue_msg(retval, msg) || 'Message Queued';
this.store_queue_result(retval, msg);
msg = `${msg} (${this.transaction.uuid})`;
if (retval !== constants.ok) {
Expand Down Expand Up @@ -1813,7 +1818,7 @@
}
}
queue_respond (retval, msg) {
if (!msg) msg = this.queue_msg(retval, msg);
msg = this.queue_msg(retval, msg);
this.store_queue_result(retval, msg);
msg = `${msg} (${this.transaction.uuid})`;

Expand Down
Loading