Skip to content

Commit

Permalink
fix: remove read lock from config get (#5114)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhq committed Sep 21, 2023
1 parent 89ea5f0 commit 2967dc5
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions core/src/config-store/base.ts
Expand Up @@ -30,18 +30,13 @@ export abstract class ConfigStore<T extends z.ZodObject<any>> {
async get<S extends keyof I<T>>(section: S): Promise<I<T>[S]>
async get<S extends keyof I<T>, K extends keyof I<T>[S]>(section: S, key: K): Promise<I<T>[S][K]>
async get<S extends keyof I<T>, K extends keyof I<T>[S]>(section?: S, key?: K) {
const release = await this.lock()
try {
const config = await this.readConfig()
if (section === undefined) {
return config
} else if (key === undefined) {
return config[section]
} else {
return config[section][key]
}
} finally {
await release()
const config = await this.readConfig()
if (section === undefined) {
return config
} else if (key === undefined) {
return config[section]
} else {
return config[section][key]
}
}

Expand Down

0 comments on commit 2967dc5

Please sign in to comment.