diff options
| author | Wayne-Cole <77279425+Wacky404@users.noreply.github.com> | 2026-06-15 21:30:52 -0500 |
|---|---|---|
| committer | Wayne-Cole <77279425+Wacky404@users.noreply.github.com> | 2026-06-15 21:30:52 -0500 |
| commit | 21b84094a397ab1ea690cc019b1dcd6698f71b50 (patch) | |
| tree | 0d384ef6f1f85553e9dc5675405cbc9febf40e66 /internal/daemon.go | |
| parent | 1cfd8a143107ab4bc50092daa45407196df0b75d (diff) | |
| download | lurchers-main.tar.xz lurchers-main.zip | |
update: impl spawnWorker func via unix protocolmain
Diffstat (limited to 'internal/daemon.go')
| -rw-r--r-- | internal/daemon.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/internal/daemon.go b/internal/daemon.go index cc202f5..62fdc5c 100644 --- a/internal/daemon.go +++ b/internal/daemon.go @@ -10,8 +10,6 @@ import ( "sync" "sync/atomic" "time" - - "lurchers/internal/api" ) type Daemon struct { @@ -28,9 +26,9 @@ func (d *Daemon) HandleConn(ctx context.Context, conn net.Conn) { scanner := bufio.NewScanner(conn) for scanner.Scan() { - var msg api.LurchMsg + var msg LurchMsg - if err := api.Decode(&msg, scanner.Bytes()); err != nil { + if err := Decode(&msg, scanner.Bytes()); err != nil { slog.Error("decode: failed to decode", "error", err) fmt.Fprintln(conn, "error: invalid json") continue @@ -38,7 +36,7 @@ func (d *Daemon) HandleConn(ctx context.Context, conn net.Conn) { slog.Info("received", "json", msg) - if err := api.Compute(ctx, &msg, conn); err != nil { + if err := Compute(ctx, &msg, conn); err != nil { slog.Error("parse: failed to parse lurch logic", "error", err) fmt.Fprintln(conn, "error: failed to parse") continue @@ -50,7 +48,8 @@ func (d *Daemon) HandleConn(ctx context.Context, conn net.Conn) { } } -func (d *Daemon) SpawnWorker(ev SysLurchEventT, timeout time.Duration) (uint64, error) { +// TODO: add in custom command later +func (d *Daemon) SpawnWorker(ev *SysLurchEventT, timeout time.Duration) (uint64, error) { offset, slotIdx, err := d.Ring.ClaimSlot() if err != nil { return 0, err @@ -64,7 +63,8 @@ func (d *Daemon) SpawnWorker(ev SysLurchEventT, timeout time.Duration) (uint64, payloadOffset := offset + SlotHeaderSize ctx, cancel := context.WithTimeout(d.Ctx, timeout) - cmd := exec.CommandContext(ctx, "jac", "howler,.py", fmt.Sprintf("%d", payloadOffset)) + // custom executions; don't know yet with jaclang + cmd := exec.CommandContext(ctx, "jac", "howler.jac", fmt.Sprintf("%d", payloadOffset)) // explicit tracking of workers d.WorkerWg.Add(1) |
