Comparing version 1.0.0 to 1.0.1
@@ -6,2 +6,3 @@ module.exports = { | ||
tolerance: 2000, | ||
maxReconnectAttempts: -1, | ||
@@ -8,0 +9,0 @@ reconnectTimeWait: 250, |
@@ -57,3 +57,2 @@ let NATS = require('nats') | ||
this.idLength = config.idLength || 16 | ||
this.clerobee = new Clerobee( this.idLength ) | ||
@@ -210,6 +209,6 @@ this.nodeID = this.clerobee.generate( ), | ||
if ( self.timeout > 0 ) { | ||
if ( self.tolerance > 0 ) { | ||
self.cleaner = setInterval( function () { | ||
self.cleanupMessages() | ||
}, self.timeout ) | ||
}, self.tolerance ) | ||
} | ||
@@ -260,8 +259,11 @@ } catch (err) { reject(err) } | ||
console.log('---------', self.tolerance) | ||
let time = Date.now() | ||
for ( let key of Object.keys( self.messages ) ) { | ||
if ( time - self.messages[key].timestamp > self.timeout ) { | ||
if ( time - self.messages[key].timestamp > self.tolerance ) { | ||
let callbackFn = self.messages[key].callback | ||
let entity = self.messages[key].entity | ||
let message = self.messages[key].message | ||
delete self.messages[ key ] | ||
callbackFn( new Error('Response timeout') ) | ||
callbackFn( new Error( `Response timeout to ${entity} ${message}` ) ) | ||
} | ||
@@ -345,3 +347,5 @@ } | ||
timestamp: Date.now(), | ||
callback | ||
callback, | ||
entity: packet.comm.entity, | ||
message: packet.comm.message | ||
} | ||
@@ -348,0 +352,0 @@ packet.comm.dispatchDate = Date.now() |
@@ -9,2 +9,4 @@ let { newQuanstructor, VALIDATION_STR, VALIDATION_NUM, VALIDATION_OBJ } = require('./Devise') | ||
idLength: { default: 16, validation: VALIDATION_NUM }, | ||
tolerance: { default: 2000, validation: VALIDATION_NUM }, | ||
reporterInterval: { default: 2000, validation: VALIDATION_NUM }, | ||
@@ -11,0 +13,0 @@ keeperInterval: { default: 3000, validation: VALIDATION_NUM }, |
{ | ||
"name": "darcon", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Simple Messaging/Service Bus for node entities over NatsIO", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -32,7 +32,9 @@ let config = require('../config') | ||
let time = Date.now() | ||
let ps = [] | ||
for (let i = 0; i < 10000; ++i) | ||
await Darconer.comm( MODE_REQUEST, '', '', 'Marie', 'echo', [ | ||
ps.push( Darconer.comm( MODE_REQUEST, '', '', 'Marie', 'echo', [ | ||
{'name': {'common': 'Belgium', 'official': 'Kingdom of Belgium', 'native': {'deu': {'official': 'K\u00f6nigreich Belgien', 'common': 'Belgien'}, 'fra': {'official': 'Royaume de Belgique', 'common': 'Belgique'}, 'nld': {'official': 'Koninkrijk Belgi\u00eb', 'common': 'Belgi\u00eb'}}}, 'tld': ['.be'], 'cca2': 'BE', 'ccn3': '056', 'cca3': 'BEL', 'cioc': 'BEL', 'independent': true, 'status': 'officially-assigned', 'currencies': {'EUR': {'name': 'Euro', 'symbol': '\u20ac'}}, 'idd': {'root': '+3', 'suffixes': ['2']}, 'capital': ['Brussels'], 'altSpellings':['BE', 'Belgi\u00eb', 'Belgie', 'Belgien', 'Belgique', 'Kingdom of Belgium', 'Koninkrijk Belgi\u00eb', 'Royaume de Belgique', 'K\u00f6nigreich Belgien'], 'region': 'Europe', 'subregion': 'Western Europe', 'languages': {'deu': 'German', 'fra': 'French', 'nld': 'Dutch'}, 'translations': {'ces': {'official': 'Belgick\u00e9 kr\u00e1lovstv\u00ed', 'common': 'Belgie'}, 'cym': {'official': 'Teyrnas Gwlad Belg', 'common': 'Gwlad Belg'}, 'deu': {'official': 'K\u00f6nigreich Belgien', 'common': 'Belgien'}, 'fra': {'official': 'Royaume de Belgique', 'common': 'Belgique'}, 'hrv': {'official': 'Kraljevina Belgija', 'common': 'Belgija'}, 'ita': {'official': 'Regno del Belgio', 'common': 'Belgio'}, 'jpn': {'official': '\u30d9\u30eb\u30ae\u30fc\u738b\u56fd', 'common': '\u30d9\u30eb\u30ae\u30fc'}, 'nld': {'official': 'Koninkrijk Belgi\u00eb', 'common': 'Belgi\u00eb'}, 'por': {'official': 'Reino da B\u00e9lgica', 'common': 'B\u00e9lgica'}, 'rus': {'official': '\u041a\u043e\u0440\u043e\u043b\u0435\u0432\u0441\u0442\u0432\u043e \u0411\u0435\u043b\u044c\u0433\u0438\u044f', 'common': '\u0411\u0435\u043b\u044c\u0433\u0438\u044f'}, 'slk': {'official': 'Belgick\u00e9 kr\u00e1\u013eovstvo', 'common': 'Belgicko'}, 'spa': {'official': 'Reino de B\u00e9lgica', 'common': 'B\u00e9lgica'}, 'fin': {'official': 'Belgian kuningaskunta', 'common': 'Belgia'}, 'est': {'official': 'Belgia Kuningriik', 'common': 'Belgia'}, 'zho': {'official': '\u6bd4\u5229\u65f6\u738b\u56fd', 'common': '\u6bd4\u5229\u65f6'}, 'pol': {'official': 'Kr\u00f3lestwo Belgii', 'common': 'Belgia'}, 'urd': {'official': '\u0645\u0645\u0644\u06a9\u062a\u0650 \u0628\u0644\u062c\u0626\u06cc\u0645', 'common': '\u0628\u0644\u062c\u0626\u06cc\u0645'}, 'kor': {'official': '\ubca8\uae30\uc5d0 \uc655\uad6d', 'common': '\ubca8\uae30\uc5d0'}, 'per': {'official': '\u067e\u0627\u062f\u0634\u0627\u0647\u06cc \u0628\u0644\u0698\u06cc\u06a9', 'common': '\u0628\u0644\u0698\u06cc\u06a9'}}, 'latlng': [50.83333333, 4], 'landlocked': false, 'borders': ['FRA', 'DEU', 'LUX', 'NLD'], 'area':30528, 'flag': '\ud83c\udde7\ud83c\uddea', 'demonyms': {'eng': {'f': 'Belgian', 'm': 'Belgian'}, 'fra': {'f': 'Belge', 'm': 'Belge'}}}, | ||
{'name': {'common': 'United Kingdom', 'official': 'United Kingdom of Great Britain and Northern Ireland', 'native': {'eng': {'official': 'United Kingdom of Great Britain and Northern Ireland', 'common': 'United Kingdom'}}}, 'tld': ['.uk'], 'cca2': 'GB', 'ccn3': '826', 'cca3': 'GBR', 'cioc': 'GBR', 'independent': true, 'status': 'officially-assigned', 'currencies': {'GBP': {'name': 'British pound', 'symbol': '\u00a3'}}, 'idd': {'root': '+4', 'suffixes': ['4']}, 'capital': ['London'], 'altSpellings': ['GB', 'UK', 'Great Britain'], 'region': 'Europe', 'subregion': 'Northern Europe', 'languages': {'eng': 'English'}, 'translations': {'ces': {'official': 'Spojen\u00e9 kr\u00e1lovstv\u00ed Velk\u00e9 Brit\u00e1nie a Severn\u00edho Irska', 'common': 'Spojen\u00e9 kr\u00e1lovstv\u00ed'}, 'deu': {'official': 'Vereinigtes K\u00f6nigreich Gro\u00dfbritannien und Nordirland', 'common': 'Vereinigtes K\u00f6nigreich'}, 'fra': {'official': 'Royaume-Uni de Grande-Bretagne et dIrlande du Nord', 'common': 'Royaume-Uni'}, 'hrv': {'official': 'Ujedinjeno Kraljevstvo Velike Britanije i Sjeverne Irske', 'common': 'Ujedinjeno Kraljevstvo'}, 'ita': {'official': 'Regno Unito di Gran Bretagna e Irlanda del Nord', 'common': 'Regno Unito'}, 'jpn': {'official': '\u30b0\u30ec\u30fc\u30c8\u00b7\u30d6\u30ea\u30c6\u30f3\u304a\u3088\u3073\u5317\u30a2\u30a4\u30eb\u30e9\u30f3\u30c9\u9023\u5408\u738b\u56fd', 'common': '\u30a4\u30ae\u30ea\u30b9'}, 'nld': {'official': 'Verenigd Koninkrijk van Groot-Brittanni\u00eb en Noord-Ierland', 'common': 'Verenigd Koninkrijk'}, 'por': {'official': 'Reino Unido da Gr\u00e3-Bretanha e Irlanda do Norte', 'common': 'Reino Unido'}, 'rus': {'official': '\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u043e\u0435 \u041a\u043e\u0440\u043e\u043b\u0435\u0432\u0441\u0442\u0432\u043e \u0412\u0435\u043b\u0438\u043a\u043e\u0431\u0440\u0438\u0442\u0430\u043d\u0438\u0438 \u0438 \u0421\u0435\u0432\u0435\u0440\u043d\u043e\u0439 \u0418\u0440\u043b\u0430\u043d\u0434\u0438\u0438', 'common': '\u0412\u0435\u043b\u0438\u043a\u043e\u0431\u0440\u0438\u0442\u0430\u043d\u0438\u044f'}, 'slk': {'official': 'Spojen\u00e9 kr\u00e1\u013eovstvo Ve\u013ekej Brit\u00e1nie a Severn\u00e9ho\u00ccrska', 'common': 'Ve\u013ek\u00e1 Brit\u00e1nia (Spojen\u00e9 kr\u00e1\u013eovstvo)'}, 'spa': {'official': 'Reino Unido de Gran Breta\u00f1a e Irlanda del Norte', 'common': 'Reino Unido'}, 'fin': {'official': 'Ison-Britannian ja Pohjois-Irlannin yhdistynyt kuningaskunta', 'common': 'Yhdistynyt kuningaskunta'}, 'est': {'official': 'Suurbritannia ja P\u00f5hja-Iiri \u00dchendkuningriik', 'common': 'Suurbritannia'}, 'zho': {'official': '\u5927\u4e0d\u5217\u98a0\u53ca\u5317\u7231\u5c14\u5170\u8054\u5408\u738b\u56fd', 'common': '\u82f1\u56fd'}, 'pol': {'official': 'Zjednoczone Kr\u00f3lestwo Wielkiej Brytanii i Irlandii P\u00f3\u0142nocnej', 'common': 'Zjednoczone Kr\u0142lestwo'}, 'urd': {'official': '\u0645\u0645\u0644\u06a9\u062a\u0650 \u0645\u062a\u062d\u062f\u06c1 \u0628\u0631\u0637\u0627\u0646\u06cc\u06c1 \u0639\u0638\u0645\u06cc \u0648 \u0634\u0645\u0627\u0644\u06cc \u0622\u0626\u0631\u0644\u06cc\u0646\u0688', 'common': '\u0645\u0645\u0644\u06a9\u062a\u0650 \u0645\u062a\u062d\u062f\u06c1'}, 'kor': {'official': '\uadf8\ub808\uc774\ud2b8\ube0c\ub9ac\ud2bc \ubd81\uc544\uc77c\ub79c\ub4dc \uc5f0\ud569 \uc655\uad6d', 'common': '\uc601\uad6d'}, 'per': {'official': '\u067e\u0627\u062f\u0634\u0627\u0647\u06cc \u0645\u062a\u062d\u062f \u0628\u0631\u06cc\u062a\u0627\u0646\u06cc\u0627\u06cc \u06a9\u0628\u06cc\u0631 \u0648 \u0627\u06cc\u0631\u0644\u0646\u062f \u0634\u0645\u0627\u0644\u06cc', 'common': '\u0627\u0646\u06af\u0644\u06cc\u0633'}}, 'latlng': [54, -2], 'landlocked': false, 'borders': ['IRL'], 'area': 242900, 'flag': '\ud83c\uddec\ud83c\udde7', 'demonyms': {'eng': {'f': 'British', 'm': 'British'}, 'fra': {'f': 'Britannique', 'm': 'Britannique'}}} | ||
] ) | ||
] ) ) | ||
await Promise.all( ps ) | ||
console.log('>>>>>>>>', (Date.now() - time) ) | ||
@@ -39,0 +41,0 @@ return 'OK' |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32287
658