]> Sergey Matveev's repositories - public-inbox.git/commit
lei: query: ensure pager exit is instantaneous
authorEric Wong <e@80x24.org>
Sun, 10 Jan 2021 12:15:11 +0000 (12:15 +0000)
committerEric Wong <e@80x24.org>
Tue, 12 Jan 2021 03:51:42 +0000 (03:51 +0000)
commit0c89ebd477d1c7a695a0a0b3023c0d41abe573fa
tree756c531c331dd7c048465448e61da51d61320696
parent372ff2ba6467e8fcea3eb19e5527a5fc398802f9
lei: query: ensure pager exit is instantaneous

Improve interactivity and user experience by allowing the user
to return to the terminal immediately when the pager is exited
(e.g. hitting the `q' key in less(1)).

This is a massive change which restructures query handling to
allow parallel search when --thread expansion is in use and
offloading to a separate worker when --thread is not in use.

The Xapian query offload changes allow us to reenter the event
loop right away once the search(es) are shipped off to the work
queue workers.

This means the main lei-daemon process can forget the lei(1)
client socket immediately once it's handed off to worker
processes.

We now unblock SIGPIPE in query workers and send an exit(141)
response to the lei(1) client socket to denote SIGPIPE.

This also allows parallelization for users using "lei q" from
multiple terminals.

JSON output is currently broken and will need to be restructured
for more flexibility and fork-safety.
lib/PublicInbox/IPC.pm
lib/PublicInbox/LEI.pm
lib/PublicInbox/LeiQuery.pm
lib/PublicInbox/LeiXSearch.pm