11import { useData } from "@/runtime/server/current"
22import { useServerSDK } from "@/runtime/server/client"
33import { normalizeProviderList } from "@/runtime/server/global-sync/utils"
4- import { isServiceUnavailableError } from "@opencode/client/promise"
5- import { retry } from "@opencode/util/retry"
64import { Iterable , pipe } from "effect"
75import { createEffect , createMemo , type Accessor } from "solid-js"
86import type { ProviderListResponse } from "@/runtime/server/types"
@@ -15,10 +13,6 @@ const emptyProviderCatalog: ProviderListResponse = { all: new Map(), connected:
1513
1614const popularProviderSet = new Set ( popularProviders )
1715
18- // A cold Location lists its catalogs once its plugins activate, which can take longer than the server's 5 s wait.
19- export const syncWhileBooting = < A > ( load : ( ) => Promise < A > ) =>
20- retry ( load , { attempts : 12 , delay : 1000 , maxDelay : 5000 , retryIf : isServiceUnavailableError } )
21-
2216export function useProviders ( directory : Accessor < string | undefined > ) {
2317 const data = useData ( )
2418 const sdk = useServerSDK ( )
@@ -35,9 +29,7 @@ export function useProviders(directory: Accessor<string | undefined>) {
3529 void ( async ( ) => {
3630 if ( ! ref ) await data . location . syncInfo ( )
3731 const resolved = ref ?? data . location . default ( )
38- await syncWhileBooting ( ( ) =>
39- Promise . all ( [ data . location . provider . sync ( resolved ) , data . location . model . sync ( resolved ) ] ) ,
40- )
32+ await Promise . all ( [ data . location . provider . sync ( resolved ) , data . location . model . sync ( resolved ) ] )
4133 } ) ( ) . catch ( ( ) => undefined )
4234 } )
4335 const integrations = useIntegrations ( directory )
0 commit comments