perf: make vcs init non-blocking by forking git branch resolution (#22771)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Effect, Layer, Context, Stream } from "effect"
|
||||
import { Effect, Layer, Context, Stream, Scope } from "effect"
|
||||
import { formatPatch, structuredPatch } from "diff"
|
||||
import path from "path"
|
||||
import { Bus } from "@/bus"
|
||||
@@ -157,6 +157,7 @@ export const layer: Layer.Layer<Service, never, AppFileSystem.Service | Git.Serv
|
||||
const fs = yield* AppFileSystem.Service
|
||||
const git = yield* Git.Service
|
||||
const bus = yield* Bus.Service
|
||||
const scope = yield* Scope.Scope
|
||||
|
||||
const state = yield* InstanceState.make<State>(
|
||||
Effect.fn("Vcs.state")(function* (ctx) {
|
||||
@@ -194,7 +195,7 @@ export const layer: Layer.Layer<Service, never, AppFileSystem.Service | Git.Serv
|
||||
|
||||
return Service.of({
|
||||
init: Effect.fn("Vcs.init")(function* () {
|
||||
yield* InstanceState.get(state)
|
||||
yield* InstanceState.get(state).pipe(Effect.forkIn(scope))
|
||||
}),
|
||||
branch: Effect.fn("Vcs.branch")(function* () {
|
||||
return yield* InstanceState.use(state, (x) => x.current)
|
||||
|
||||
Reference in New Issue
Block a user