debug: add info when TCP data flushing is taking a long time

This commit is contained in:
Unitech 2016-03-27 13:48:32 +02:00
parent d0f496b55a
commit f6d0fbf817

View File

@ -264,7 +264,11 @@ var PushInteractor = module.exports = {
var t1 = new Date();
self.tcpSocket.sendv2(str, function() {
debugInfo('Time to flush data %ds', (new Date() - t1) / 1000);
var duration_sec = (new Date() - t1) / 1000;
debugInfo('Time to flush data %ds', duration_sec);
if (duration_sec > 0.8)
console.error('[CRITICAL] Time to send data over TCP is taking %dseconds!', duration_sec);
data = null;
str = null;
return cb();