diff options
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) |
