Using worker id as lock

This commit is contained in:
2022-04-04 22:28:39 +09:00
parent 9c0b3474e9
commit 4207a5b90e
2 changed files with 4 additions and 5 deletions
+3 -3
View File
@@ -15,9 +15,9 @@ Package.prototype.rootNS = function( name, path )
var _reload = function( e, filename )
{
if( this._lock )
if( this._lock == global.X_SERVER_CLUSTER.worker.id )
return;
this._lock = true;
this._lock = global.X_SERVER_CLUSTER.worker.id;
setTimeout( () =>
{
@@ -34,7 +34,7 @@ Package.prototype.load = function( _class )
var file = rootNS[ nsdomain ] + _class;
if( global.debug && global.X_SERVER_CLUSTER )
if( global.debug && global.X_SERVER_CLUSTER && global.X_SERVER_CLUSTER.worker )
{
var src = require.resolve( file );
if(!( src in require.cache ))