mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-14 02:24:53 +00:00
fix(app): drop the dead plugin-boot retry on catalog syncs (#62830)
This commit is contained in:
parent
4de7680c3b
commit
12a661ea40
3 changed files with 4 additions and 12 deletions
|
|
@ -1,8 +1,6 @@
|
|||
import { useData } from "@/runtime/server/current"
|
||||
import { useServerSDK } from "@/runtime/server/client"
|
||||
import { normalizeProviderList } from "@/runtime/server/global-sync/utils"
|
||||
import { isServiceUnavailableError } from "@opencode/client/promise"
|
||||
import { retry } from "@opencode/util/retry"
|
||||
import { Iterable, pipe } from "effect"
|
||||
import { createEffect, createMemo, type Accessor } from "solid-js"
|
||||
import type { ProviderListResponse } from "@/runtime/server/types"
|
||||
|
|
@ -15,10 +13,6 @@ const emptyProviderCatalog: ProviderListResponse = { all: new Map(), connected:
|
|||
|
||||
const popularProviderSet = new Set(popularProviders)
|
||||
|
||||
// A cold Location lists its catalogs once its plugins activate, which can take longer than the server's 5 s wait.
|
||||
export const syncWhileBooting = <A>(load: () => Promise<A>) =>
|
||||
retry(load, { attempts: 12, delay: 1000, maxDelay: 5000, retryIf: isServiceUnavailableError })
|
||||
|
||||
export function useProviders(directory: Accessor<string | undefined>) {
|
||||
const data = useData()
|
||||
const sdk = useServerSDK()
|
||||
|
|
@ -35,9 +29,7 @@ export function useProviders(directory: Accessor<string | undefined>) {
|
|||
void (async () => {
|
||||
if (!ref) await data.location.syncInfo()
|
||||
const resolved = ref ?? data.location.default()
|
||||
await syncWhileBooting(() =>
|
||||
Promise.all([data.location.provider.sync(resolved), data.location.model.sync(resolved)]),
|
||||
)
|
||||
await Promise.all([data.location.provider.sync(resolved), data.location.model.sync(resolved)])
|
||||
})().catch(() => undefined)
|
||||
})
|
||||
const integrations = useIntegrations(directory)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { batch, createEffect, createMemo, createRoot, createSignal, onCleanup, u
|
|||
import { Predicate, Schema, SchemaGetter } from "effect"
|
||||
import { useModels } from "@/providers/models/models"
|
||||
import { useSettings } from "@/settings/model"
|
||||
import { syncWhileBooting, useProviders } from "@/providers/catalog/providers"
|
||||
import { useProviders } from "@/providers/catalog/providers"
|
||||
import { Persist, persisted } from "@/runtime/persistence/storage"
|
||||
import { Persistence } from "@/runtime/persistence/schema"
|
||||
import { usePlatform, type Platform } from "@/runtime/platform/platform"
|
||||
|
|
@ -331,7 +331,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
|
|||
const directory = sdk().directory
|
||||
|
||||
if (!directory) return
|
||||
void syncWhileBooting(() => data.location.agent.sync({ directory })).catch(() => undefined)
|
||||
void data.location.agent.sync({ directory }).catch(() => undefined)
|
||||
})
|
||||
|
||||
const agentsVisible = createMemo(() => settings.visibility.customAgents() || hasCustomAgent(list()))
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import type { Accessor } from "solid-js"
|
|||
import { useServer } from "@/runtime/server/current"
|
||||
import { useProviders } from "../../../../app/src/providers/catalog/providers"
|
||||
|
||||
export { popularProviders, syncWhileBooting } from "../../../../app/src/providers/catalog/providers"
|
||||
export { popularProviders } from "../../../../app/src/providers/catalog/providers"
|
||||
|
||||
export { useStoryProviders as useProviders }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue