kevinschoon / pomo

Pomodoro CLI

Home Page:https://kevinschoon.github.io/pomo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`pomo status` no longer works in "publish" mode

amiel opened this issue · comments

I love the idea behind "publish" mode, but enabling it causes pomo status to hang. I believe this is because pomo status relies on the socket that normal mode writes to.

My suggestion is to always listen on the normal socket, and have the "publish" mode use a different socket path to publish to, so it is no longer publish or listen, but publish and listen.

Also, I am happy to work on this, but wanted to get feedback on the strategy before I dive in...

@amiel Thanks for reporting this issue. I wasn't actually able to reproduce it by switching between publish=true|false but I believe you 🙂. Please feel free to open a PR and we can make any changes as needed.

I'm also open to the possibility that I'm simply doing something wrong.

I'd like to give you reproduction steps, but that involves running a server that creates and listens on the socket.

Here's how to reproduce what I am seeing:

  1. Clone https://github.com/amiel/pomo-event

    • NOTE that you'll need a rust toolchain set up to run this. I'm sure it would be fairly trivial to write the same thing in go...
  2. Configure pomo to publish and publish with json:

    {
      "publish": true,
      "publishJson": true
    }

    Optionally change the socket path.

  3. Make sure the socket file does not exist (rm ~/.pomo/pomo.sock)

  4. Run pomo-event

    cd path/to/pomo-event
    cargo run
    
  5. In another shell, start a pomodoro with pomo

    pomo s -d 2m -p 1 -t Test "Testing pomodoro tooling"
    # Or reuse a previous test
    

    You should see status printed every second in pomo-event.

  6. In yet another shell, run pomo status

    pomo status
    # hangs
    

I'm realizing now that I could resolve my issue by having pomo-event keep track of the current status (which I plan to have it do), and respond with the full json status when it gets the "status" signal from pomo status. That would resolve my issue, but I'm not sure if anyone else might run in to this too...