mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
fix: prevent consts from triggering after leaving effect context
This commit is contained in:
@@ -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": {
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user