mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-23 17:14:55 +00:00
fix(account): resilient orgs fetch (#16944)
This commit is contained in:
@@ -192,11 +192,17 @@ export class AccountService extends ServiceMap.Service<
|
|||||||
|
|
||||||
const orgsByAccount = Effect.fn("AccountService.orgsByAccount")(function* () {
|
const orgsByAccount = Effect.fn("AccountService.orgsByAccount")(function* () {
|
||||||
const accounts = yield* repo.list()
|
const accounts = yield* repo.list()
|
||||||
return yield* Effect.forEach(
|
const [errors, results] = yield* Effect.partition(
|
||||||
accounts,
|
accounts,
|
||||||
(account) => orgs(account.id).pipe(Effect.map((orgs) => ({ account, orgs }))),
|
(account) => orgs(account.id).pipe(Effect.map((orgs) => ({ account, orgs }))),
|
||||||
{ concurrency: 3 },
|
{ concurrency: 3 },
|
||||||
)
|
)
|
||||||
|
for (const error of errors) {
|
||||||
|
yield* Effect.logWarning("failed to fetch orgs for account").pipe(
|
||||||
|
Effect.annotateLogs({ error: String(error) }),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return results
|
||||||
})
|
})
|
||||||
|
|
||||||
const orgs = Effect.fn("AccountService.orgs")(function* (accountID: AccountID) {
|
const orgs = Effect.fn("AccountService.orgs")(function* (accountID: AccountID) {
|
||||||
|
|||||||
Reference in New Issue
Block a user