Skip to content

fix(glyph): parallelize mcpjungle server registration#343

Merged
stackptr merged 3 commits intomainfrom
fix/mcpjungle-register-parallel
Mar 10, 2026
Merged

fix(glyph): parallelize mcpjungle server registration#343
stackptr merged 3 commits intomainfrom
fix/mcpjungle-register-parallel

Conversation

@stackptr
Copy link
Owner

@stackptr stackptr commented Mar 10, 2026

Summary

  • mcpjungle-register.service blocked nixos-rebuild switch because it was a Type=oneshot in multi-user.target, polling 9 servers sequentially (up to 9 min worst case)
  • Parallelize registrations so all servers are polled concurrently
  • Replace wantedBy = ["multi-user.target"] with a systemd timer that fires 5s after activation — timer start/restart is instant, never blocks
  • Change Type=oneshot to Type=simple so even if NixOS starts the service directly, systemctl start returns immediately
  • Add restartTriggers on the timer keyed to server config hash, so adding/removing servers re-triggers registration

Test plan

  • Rebuild glyph and verify nixos-rebuild switch completes without hanging
  • Verify mcpjungle-register.timer is active: systemctl status mcpjungle-register.timer
  • Verify all MCP servers register after timer fires: journalctl -u mcpjungle-register -f

🤖 Generated with Claude Code

stackptr and others added 3 commits March 9, 2026 19:32
The mcpjungle-register oneshot service registered 9 servers
sequentially, each polling up to 60s for availability. This blocked
nixos-rebuild switch for up to 9 minutes in the worst case.

Run each registration in a background subshell so all servers are
polled concurrently, reducing worst-case wait to 60s.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The mcpjungle-register oneshot service was in multi-user.target,
causing nixos-rebuild switch to block until all 9 MCP servers were
polled and registered (up to 60s even with parallel registration).

Replace the direct wantedBy with a systemd timer that fires 5s after
activation. The timer start/restart is instant so activation never
blocks. The timer has restartTriggers based on the server config hash,
so adding/removing servers re-triggers registration. The service itself
has restartIfChanged = false to prevent NixOS from directly restarting
(and blocking on) the oneshot during activation.

Also parallelizes registrations within the script and removes
RemainAfterExit since the timer handles re-triggering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Type=oneshot causes systemctl start to block until the script
completes. Changing to Type=simple makes systemctl start return
immediately — the registration script still runs to completion in
the background.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@stackptr stackptr merged commit 9057b36 into main Mar 10, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant