better code
Massimo Melina committed
Oct 15, 2024 at 23:25 UTC
d3bf0ad6eb75ca45316e7e3803be7c361a2a0415
2 files changed
+2
-2
src/connections.ts
+1
-1
@@ -81,6 +81,6 @@ export function disconnect(what: Context | Socket, debugLog='') {
81
if ('socket' in what)
82
what = what.socket
83
if (debugLog)
84
- console.debug("disconnection:", debugLog, what.remoteAddress)
84
+ console.debug("disconnection:", debugLog, normalizeIp(what.remoteAddress || ''))
85
return what.destroy()
86
}
\ No newline at end of file
src/log.ts
+1
-1
@@ -68,7 +68,7 @@ const dontLogNet = defineConfig(CFG.dont_log_net, '127.0.0.1|::1', v => makeNetM
68
const logUA = defineConfig(CFG.log_ua, false)
69
const logSpam = defineConfig(CFG.log_spam, false)
70
71
-const debounce = _.debounce(cb => cb(), 1000)
71
+const debounce = _.debounce(cb => cb(), 1000) // with this technique, i'll be able to debounce some code respecting the references in its closure
72
73
export const logMw: Koa.Middleware = async (ctx, next) => {
74
const now = new Date()