Skip to content

Commit

Permalink
fix: race condition issue - reading settings.json file
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan committed Apr 11, 2024
1 parent 9e7bdc7 commit 0d31f9e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion extensions/monitoring-extension/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ const DEFAULT_SETTINGS: GpuSetting = {

export const getGpuConfig = async (): Promise<GpuSetting | undefined> => {
if (process.platform === 'darwin') return undefined
return JSON.parse(readFileSync(GPU_INFO_FILE, 'utf-8'))
if (existsSync(GPU_INFO_FILE))
return JSON.parse(readFileSync(GPU_INFO_FILE, 'utf-8'))
return DEFAULT_SETTINGS
}

export const getResourcesInfo = async (): Promise<ResourceInfo> => {
Expand Down

0 comments on commit 0d31f9e

Please sign in to comment.