Using worker id as lock
This commit is contained in:
parent
9c0b3474e9
commit
4207a5b90e
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
const zlib = require( "zlib" );
|
const zlib = require( "zlib" );
|
||||||
const os = require( "os" )
|
const os = require( "os" )
|
||||||
|
const fs = require( "fs" );
|
||||||
|
|
||||||
const cl = global.botanLoader;
|
const cl = global.botanLoader;
|
||||||
const Dragonfly = global.Dragonfly;
|
const Dragonfly = global.Dragonfly;
|
||||||
@ -204,8 +205,6 @@ class WebFrame
|
|||||||
|
|
||||||
resp.headers[ "Content-Disposition" ] = "attachment; filename=\"" + name + "\"";
|
resp.headers[ "Content-Disposition" ] = "attachment; filename=\"" + name + "\"";
|
||||||
|
|
||||||
var fs = require( "fs" );
|
|
||||||
|
|
||||||
Dragonfly.Debug( "Stream out: " + path );
|
Dragonfly.Debug( "Stream out: " + path );
|
||||||
|
|
||||||
var rs = fs.createReadStream( path );
|
var rs = fs.createReadStream( path );
|
||||||
|
@ -15,9 +15,9 @@ Package.prototype.rootNS = function( name, path )
|
|||||||
|
|
||||||
var _reload = function( e, filename )
|
var _reload = function( e, filename )
|
||||||
{
|
{
|
||||||
if( this._lock )
|
if( this._lock == global.X_SERVER_CLUSTER.worker.id )
|
||||||
return;
|
return;
|
||||||
this._lock = true;
|
this._lock = global.X_SERVER_CLUSTER.worker.id;
|
||||||
|
|
||||||
setTimeout( () =>
|
setTimeout( () =>
|
||||||
{
|
{
|
||||||
@ -34,7 +34,7 @@ Package.prototype.load = function( _class )
|
|||||||
|
|
||||||
var file = rootNS[ nsdomain ] + _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 );
|
var src = require.resolve( file );
|
||||||
if(!( src in require.cache ))
|
if(!( src in require.cache ))
|
||||||
|
Loading…
Reference in New Issue
Block a user