generated from eblume/project-template
heph.nvim: rip out auto-spawn — connect-only plugin
All checks were successful
Build / validate (pull_request) Successful in 10m44s
All checks were successful
Build / validate (pull_request) Successful in 10m44s
The daemon is now an OS service (`heph daemon`); the plugin no longer spawns or supervises one. Removes the managed-daemon machinery entirely. - delete lua/heph/daemon.lua (spawn/ensure/stop_spawned/self-heal) - init.lua: connect-only; probe `health` once and guide to `heph daemon start` - rpc.lua: drop set_respawn + respawn-on-drop; a dropped connection just reconnects once (e.g. after `heph daemon restart`), never spawns - config.lua: drop autostart/bin/db; stable socket fallback (data-dir, matches hephd::default_socket_path), keep $HEPH_SOCKET for dev isolation - tests: spawn/wait_ready move into the e2e harness (test infra); rework managed_daemon_spec into a connect-only spec (connect / clean-fail / reconnect) 16 nvim e2e specs pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0cfe627055
commit
cdd4d9f62a
6 changed files with 114 additions and 308 deletions
|
|
@ -182,13 +182,6 @@ function M.session()
|
|||
return M._default
|
||||
end
|
||||
|
||||
--- Register a hook that (re)ensures the daemon — called once to self-heal a
|
||||
--- dropped connection before a single retry. `nil` disables self-heal (used when
|
||||
--- autostart is off, so a connect-only setup fails loudly instead of respawning).
|
||||
function M.set_respawn(fn)
|
||||
M._respawn = fn
|
||||
end
|
||||
|
||||
local function is_connection_error(msg)
|
||||
msg = tostring(msg)
|
||||
return msg:find("connect", 1, true) ~= nil
|
||||
|
|
@ -196,16 +189,15 @@ local function is_connection_error(msg)
|
|||
or msg:find("timeout", 1, true) ~= nil
|
||||
end
|
||||
|
||||
--- Blocking call on the default session. If the call fails because the
|
||||
--- connection is dead and a respawn hook is set, ensure the daemon and retry
|
||||
--- once (the prior owner releases the DB lock on exit, so a respawn can claim it).
|
||||
--- Blocking call on the default session. The plugin is connect-only: on a
|
||||
--- dropped connection we drop the dead session and **reconnect once** (e.g. the
|
||||
--- daemon was restarted via `heph daemon restart`) — we never spawn a daemon.
|
||||
function M.call(method, params, opts)
|
||||
local ok, result = pcall(M.session().call, M.session(), method, params, opts)
|
||||
if ok then
|
||||
return result
|
||||
end
|
||||
if M._respawn and is_connection_error(result) then
|
||||
pcall(M._respawn)
|
||||
if is_connection_error(result) then
|
||||
M.session():close() -- drop the dead connection so the retry reconnects
|
||||
return M.session():call(method, params, opts)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue