Skip to content

Commit

Permalink
Refactor import/exportConfigs
Browse files Browse the repository at this point in the history
  • Loading branch information
baku89 committed Oct 24, 2023
1 parent e0f3d87 commit 3841c94
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/Tethr.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import EventEmitter from 'eventemitter3'
import {vec2} from 'linearly'
import sleep from 'sleep-promise'

import {
Aperture,
Expand Down Expand Up @@ -130,7 +129,8 @@ export abstract class Tethr
const configs = await Promise.all(
WritableConfigNameList.map(async name => {
const desc = await this.getDesc(name)
return desc.value === null ? null : ([name, desc.value] as const)
if (!desc.writable || desc.value === null) return null
return [name, desc.value] as const
})
)

Expand All @@ -151,10 +151,14 @@ export abstract class Tethr

for (const [name, value] of sortedConfigs) {
// NOTE: this might be converted to parallel execution in the future
await this.set(name, value)
try {
await this.set(name, value)
} finally {
null
}

// The delay is necessary to avoid "busy" error
await sleep(25)
// await sleep(25)
}
}

Expand Down

0 comments on commit 3841c94

Please sign in to comment.