Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Implement a socket API for the background evaluator #32

Closed
Profpatsch opened this issue Apr 4, 2019 · 1 comment
Closed

Implement a socket API for the background evaluator #32

Profpatsch opened this issue Apr 4, 2019 · 1 comment
Labels
feature request Request for new functionality P1 critical: next release

Comments

@Profpatsch
Copy link
Collaborator

Profpatsch commented Apr 4, 2019

@grahamc writes:

The background evaluator will need to listen for new projects to watch. To do so, the evaluator should listen on a unix socket at a Well Known Location (see XDG spec for where -- not sure which subsection at this time) new projects. The API should also support "cancel" messages, to stop watching a project.

Note, because of the nature of direnv -- many shells opening the same project -- we'll want to implement a refcount like system, and only "cancel" the evaluation when the last shell closes.

Blocked on #33

@zimbatm writes:

Another approach would be to "keep-alive" the daemon:

the user enters the project folder: lorri evaluate --folder $PWD is called
if $XDG_RUNTIME_DIR/lorri/daemon.sock doesn't exist (or isn't alive), start the daemon
send a message watch /path/to/project to the daemon
The daemon is started with a default TTL per project. If the TTL is reached, stop watching the project. If no projects are to be watched, shutdown the daemon and remove the socket.

Whenever files are changed in the project, extend the TTL.

The only issue is if the user sits too long in the project, with no files changing. Let's say the user goes to lunch and comes back to his seat. In that case the user would still be in the shell but the daemon has shutdown. This could be solved by running lorri evaluate --folder $PWD on each prompt, but then it means that lorri needs to hook into the shell as well.

@shlevy writes:

Just mentioned this on #33, but why don't we just treat socket close as the "cancel" command?

@Profpatsch Profpatsch added feature request Request for new functionality P1 critical: next release labels Apr 4, 2019
@Profpatsch
Copy link
Collaborator Author

Done in #81

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature request Request for new functionality P1 critical: next release
Projects
None yet
Development

No branches or pull requests

1 participant