Поправки багов

This commit is contained in:
Book Pauk
2018-12-26 22:08:55 +07:00
parent 4c3f175e71
commit 5e07fdc750
4 changed files with 8 additions and 8 deletions

View File

@@ -153,11 +153,11 @@ class FileLog extends BaseLog {
}, LOG_ROTATE_FILE_CHECK_INTERVAL); }, LOG_ROTATE_FILE_CHECK_INTERVAL);
}; };
await fs.writeAsync(this.fd, new Buffer(data.join(''))); await fs.writeAsync(this.fd, Buffer.from(data.join('')));
} }
flushImplSync(data) { flushImplSync(data) {
fs.writeSync(this.fd, new Buffer(data.join(''))); fs.writeSync(this.fd, Buffer.from(data.join('')));
} }
} }

View File

@@ -6,15 +6,16 @@ const waitingDelay = 100; //ms
class SqliteConnectionPool { class SqliteConnectionPool {
constructor(connCount, logger, config) { constructor(connCount, logger, config) {
this.config = config;
this.connCount = connCount; this.connCount = connCount;
this.logger = logger;
this.config = config;
} }
async init() { async init() {
this.logger.log('Opening database'); this.logger.log('Opening database');
utils.mkDirIfNotExistsSync(config.dataDir); utils.mkDirIfNotExistsSync(this.config.dataDir);
const dbFileName = config.dataDir + '/' + config.dbFileName; const dbFileName = this.config.dataDir + '/' + this.config.dbFileName;
this.connections = []; this.connections = [];
this.taken = new Set(); this.taken = new Set();

View File

@@ -13,7 +13,6 @@ function statPathSync(path) {
} }
function mkDirIfNotExistsSync(path) { function mkDirIfNotExistsSync(path) {
console.log(path);
let exists = statPathSync(path); let exists = statPathSync(path);
if (!exists) { if (!exists) {
fs.mkdirSync(path, {recursive: true, mode: 0o755}); fs.mkdirSync(path, {recursive: true, mode: 0o755});

View File

@@ -10,8 +10,8 @@ async function main() {
const connPool = new SqliteConnectionPool(20, logger, config); const connPool = new SqliteConnectionPool(20, logger, config);
await connPool.init(); await connPool.init();
app.use(app.json()); app.use(express.json());
app.static('public'); express.static('public');
require('./routes')(app, connPool, logger, config); require('./routes')(app, connPool, logger, config);