mirror of
https://github.com/whyour/qinglong.git
synced 2026-07-01 04:40:38 +08:00
写入文件增加文件锁,避免竞争条件引起文件内容异常
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
} from '../data/env';
|
||||
import groupBy from 'lodash/groupBy';
|
||||
import { FindOptions, Op } from 'sequelize';
|
||||
import { writeFileWithLock } from '../shared/utils';
|
||||
|
||||
@Service()
|
||||
export default class EnvService {
|
||||
@@ -225,8 +226,8 @@ export default class EnvService {
|
||||
}
|
||||
}
|
||||
}
|
||||
await fs.writeFile(config.envFile, env_string);
|
||||
await fs.writeFile(config.jsEnvFile, js_env_string);
|
||||
await fs.writeFile(config.pyEnvFile, py_env_string);
|
||||
await writeFileWithLock(config.envFile, env_string);
|
||||
await writeFileWithLock(config.jsEnvFile, js_env_string);
|
||||
await writeFileWithLock(config.pyEnvFile, py_env_string);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user