mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-12 07:34:41 +02:00
Fix oputil hang
This commit is contained in:
parent
c9674e68fb
commit
f3cd36ad07
3 changed files with 28 additions and 21 deletions
|
@ -100,7 +100,14 @@ function init(configPath, options, cb) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const ConfigCache = require('./config_cache.js');
|
const ConfigCache = require('./config_cache.js');
|
||||||
ConfigCache.getConfigWithOptions( { filePath : configPath, callback : changed }, (err, config) => {
|
const getConfigOptions = {
|
||||||
|
filePath : configPath,
|
||||||
|
noWatch : options.noWatch,
|
||||||
|
};
|
||||||
|
if(!options.noWatch) {
|
||||||
|
getConfigOptions.callback = changed;
|
||||||
|
}
|
||||||
|
ConfigCache.getConfigWithOptions(getConfigOptions, (err, config) => {
|
||||||
if(err) {
|
if(err) {
|
||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ module.exports = new class ConfigCache
|
||||||
if(options.forceReCache || !cached) {
|
if(options.forceReCache || !cached) {
|
||||||
this.recacheConfigFromFile(options.filePath, (err, config) => {
|
this.recacheConfigFromFile(options.filePath, (err, config) => {
|
||||||
if(!err && !cached) {
|
if(!err && !cached) {
|
||||||
|
if(!options.noWatch) {
|
||||||
const watcher = sane(
|
const watcher = sane(
|
||||||
paths.dirname(options.filePath),
|
paths.dirname(options.filePath),
|
||||||
{
|
{
|
||||||
|
@ -38,6 +39,7 @@ module.exports = new class ConfigCache
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return cb(err, config, true);
|
return cb(err, config, true);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const resolvePath = require('../misc_util.js').resolvePath;
|
|
||||||
|
|
||||||
const config = require('../../core/config.js');
|
const config = require('../../core/config.js');
|
||||||
const db = require('../../core/database.js');
|
const db = require('../../core/database.js');
|
||||||
|
|
||||||
|
@ -57,7 +55,7 @@ function getConfigPath() {
|
||||||
function initConfig(cb) {
|
function initConfig(cb) {
|
||||||
const configPath = getConfigPath();
|
const configPath = getConfigPath();
|
||||||
|
|
||||||
config.init(configPath, { keepWsc : true }, cb);
|
config.init(configPath, { keepWsc : true, noWatch : true }, cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initConfigAndDatabases(cb) {
|
function initConfigAndDatabases(cb) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue