Skip to content

Commit

Permalink
perf: parallelize clear writes
Browse files Browse the repository at this point in the history
  • Loading branch information
mshanemc committed Oct 19, 2023
1 parent 903fc59 commit 25a525a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,13 +402,12 @@ export class Config extends ConfigFile<ConfigFile.Options, ConfigProperties> {
* Clear all the configured properties both local and global.
*/
public static async clear(): Promise<void> {
const globalConfig = await Config.create({ isGlobal: true });
globalConfig.clear();
await globalConfig.write();
const [globalConfig, localConfig] = await Promise.all([Config.create({ isGlobal: true }), Config.create()]);

const localConfig = await Config.create();
globalConfig.clear();
localConfig.clear();
await localConfig.write();

await Promise.all([globalConfig.write(), localConfig.write()]);
}

public static getPropertyConfigMeta(propertyName: string): Nullable<ConfigPropertyMeta> {
Expand Down

0 comments on commit 25a525a

Please sign in to comment.