-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mu server: add ID to requests to make them stateless #1280
Comments
Looking at the broader picture: why do we need a long running process anyways ( Is this a performance concern? |
Forget my last comment, it can't work: the headers update take almost a second and Emacs hangs for that long every |
Keeping around a running mu-server is for two reasons:
As for IDs... dunno, it shouldn't be too hard (but adds some more complexity to the server); however, the server is synchronous, so you get back your answers (possibly multiple per command) in exactly the same order as you send commands. Generally it's a bit tricky to depend on various mu4e implementation details, which could change at any time; and especially changing those details for some external use-case. E.g., I can foresee that once we can overcome the problems with the gnus-based viewer, that could replace the existing viewer. With that in place; and then we could get rid of |
Acknowledged. IDs are always a good idea as they allow the client to map between requests and responses. I've implemented a (somewhat hacky) implementation of it with https://gitlab.com/ambrevar/mu4e-conversation: look at While it works it would be even better if the server would support IDs / callbacks out of the box. |
Yeah, guess I agree with my 2018 answer; and to add to that, the comms protocol between mu and mu4e is not really the right place for third-party extensions; it does change fairly frequently (I just did a bunch of changes), for optimization, new features etc., and I really don't want any backward-compat headaches there. There are some newer tickets about third-party APIs, such as #2520 and #2210, so I guess the discussion can continue there. |
I'm trying to add support to live updates of conversation buffers to mu4e-conversation and I'm facing some issues with regard to communicating with
mu server
.As I understand it, each request sent to the server will result in one or more s-exps.
mu4e~proc-send-command
sends the request, Emacs resumes its activity until it idles and thenmu4e~proc-filter
catches the s-exps when they are emitted.My current strategy to send requests tailored to mu4e-conversation is to advise the filter handlers (e.g.
mu4e~headers-found-handler
) with a custom function (e.g. collect all the thread messages in a structure for future display). I add the advice when sending the commands and I remove it from the advice itself.While this works in the simple case, it remains brittle in the more general case as it leads to race conditions: when sending requests A then B, expecting answers A' and B' respectively, if A' does not get parsed before B is sent, the advice will be (wrongfully) removed before B' can be parsed.
(This is akin to client-server networking problems.)
One solution around would be to make everything stateless by adding request IDs to the requests, so that each command has a unique mapping to a set of requests.
This way it would be easy to specialize handlers for specific commands only.
It would be even nicer to make everything functional, i.e. get the s-exps as a return value of the command. I'm not sure if it's possible to do that however.
Insights?
The text was updated successfully, but these errors were encountered: