Skip to content

Commit 4d3831a

Browse files
committed
remove async await in when clause
1 parent 7e08dc1 commit 4d3831a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/core/src/awsexplorer/regionNode.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ interface ServiceNode {
4242
* when: () => DevSettings.instance.isDevMode()
4343
* ```
4444
*/
45-
when?: () => boolean | Promise<boolean>
45+
when?: () => boolean
4646
createFn: (regionCode: string, partitionId: string) => any
4747
}
4848

@@ -65,7 +65,7 @@ const serviceCandidates: ServiceNode[] = [
6565
},
6666
{
6767
serviceId: 'ec2',
68-
when: async () => await Experiments.instance.isExperimentEnabled('ec2RemoteConnect'),
68+
when: () => Experiments.instance.isExperimentEnabled('ec2RemoteConnect'),
6969
createFn: (regionCode: string, partitionId: string) =>
7070
new Ec2ParentNode(regionCode, partitionId, new Ec2Client(regionCode)),
7171
},
@@ -145,7 +145,7 @@ export class RegionNode extends AWSTreeNodeBase {
145145
const partitionId = this.regionProvider.getPartitionId(this.regionCode) ?? defaultPartition
146146
const childNodes: AWSTreeNodeBase[] = []
147147
for (const service of serviceCandidates) {
148-
if (service.when !== undefined && !(await service.when())) {
148+
if (service.when !== undefined && !service.when()) {
149149
continue
150150
}
151151
if (service.allRegions || this.regionProvider.isServiceInRegion(service.serviceId, this.regionCode)) {

packages/core/src/shared/settings.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,12 +726,12 @@ export class Experiments extends Settings.define(
726726
'aws.experiments',
727727
toRecord(keys(experiments), () => Boolean)
728728
) {
729-
public async isExperimentEnabled(name: ExperimentName): Promise<boolean> {
729+
public isExperimentEnabled(name: ExperimentName): boolean {
730730
try {
731731
return this._getOrThrow(name, false)
732732
} catch (error) {
733733
this._log(`experiment check for ${name} failed: %s`, error)
734-
await this.reset()
734+
this.reset().catch((e) => getLogger().error(`failed to reset experiment settings: %O`, e))
735735

736736
return false
737737
}

0 commit comments

Comments
 (0)