Поправки багов
This commit is contained in:
@@ -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('')));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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});
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user