fix: prevent consts from triggering after leaving effect context

This commit is contained in:
Aiden McClelland
2026-03-16 20:07:59 -06:00
parent 7352602f58
commit 66a606c14e
3 changed files with 7 additions and 8 deletions

View File

@@ -298,13 +298,10 @@ export class RpcListener {
}
case "stop": {
const { id } = stopType.parse(input)
this.callbacks?.removeChild("main")
return handleRpc(
id,
this.system.stop().then((result) => {
this.callbacks?.removeChild("main")
return { result }
}),
this.system.stop().then((result) => ({ result })),
)
}
case "exit": {

View File

@@ -71,7 +71,7 @@ export class SystemForStartOs implements System {
this.starting = true
effects.constRetry = utils.once(() => {
console.debug(".const() triggered")
effects.restart()
if (effects.isInContext) effects.restart()
})
let mainOnTerm: () => Promise<void> | undefined
const daemons = await (

View File

@@ -83,10 +83,12 @@ export abstract class Watchable<Raw, Mapped = Raw> {
const constRetry = this.effects.constRetry
const cleanup = this.onConstRegistered(value)
gen.next().then(
() => {
(a) => {
abort.abort()
cleanup?.()
constRetry()
if (!a.done) {
constRetry()
}
},
() => {
abort.abort()