Skip to content

Commit c7dafc6

Browse files
committed
Cloud: actually track settings fetch success
1 parent 2015290 commit c7dafc6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

packages/cloud/src/SettingsService.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ export class SettingsService {
2525

2626
this.timer = new RefreshTimer({
2727
callback: async () => {
28-
await this.fetchSettings(callback)
29-
return true
28+
return await this.fetchSettings(callback)
3029
},
3130
successInterval: 30000,
3231
initialBackoffMs: 1000,
@@ -56,11 +55,11 @@ export class SettingsService {
5655
}
5756
}
5857

59-
private async fetchSettings(callback: () => void): Promise<void> {
58+
private async fetchSettings(callback: () => void): Promise<boolean> {
6059
const token = this.authService.getSessionToken()
6160

6261
if (!token) {
63-
return
62+
return false
6463
}
6564

6665
try {
@@ -72,15 +71,15 @@ export class SettingsService {
7271

7372
if (!response.ok) {
7473
console.error(`Failed to fetch organization settings: ${response.status} ${response.statusText}`)
75-
return
74+
return false
7675
}
7776

7877
const data = await response.json()
7978
const result = organizationSettingsSchema.safeParse(data)
8079

8180
if (!result.success) {
8281
console.error("Invalid organization settings format:", result.error)
83-
return
82+
return false
8483
}
8584

8685
const newSettings = result.data
@@ -90,8 +89,11 @@ export class SettingsService {
9089
await this.cacheSettings()
9190
callback()
9291
}
92+
93+
return true
9394
} catch (error) {
9495
console.error("Error fetching organization settings:", error)
96+
return false
9597
}
9698
}
9799

0 commit comments

Comments
 (0)