[RFC v2] www: add topics_(new|active).(html|atom) endpoints

2023-11-09 Thread Eric Wong
Konstantin Ryabitsev wrote: > On Thu, Nov 09, 2023 at 02:45:08AM +, Eric Wong wrote: > > This seems like a easy (but WWW-specific) way to get recent > > topics as suggested by Konstantin. Perhaps an Atom endpoint > > will also be useful. > > Yes, actually thinking about this some more,

Re: [RFC] www: add topics.html endpoint [was: Query to see all new "topics"]

2023-11-09 Thread Konstantin Ryabitsev
On Thu, Nov 09, 2023 at 02:45:08AM +, Eric Wong wrote: > This seems like a easy (but WWW-specific) way to get recent > topics as suggested by Konstantin. Perhaps an Atom endpoint > will also be useful. Yes, actually thinking about this some more, perhaps it makes sense to expose this as an

[PATCH 13/13] spawn: get rid of wantarray popen_rd/popen_wr

2023-11-09 Thread Eric Wong
We've updated all of our users to use Process::IO (and avoiding tied handles) so the trade-off for using the array context no longer exists. --- lib/PublicInbox/Spawn.pm | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm

[PATCH 10/13] lei_input: always close single `eml' inputs

2023-11-09 Thread Eric Wong
This matches the behavior we have for multi-message mbox files since we rely on ->close to detect errors on bad mboxes. This ensures we'll notice errors reading single messages from stdin. We'll also start relying more on strace error injection to test error handling. ---

[PATCH 12/13] lei: get rid of autoreap usage

2023-11-09 Thread Eric Wong
We can rely on Process::IO->DESTROY to close and reap in these cases. This is the final step in eliminating the wantarray invocations of popen_rd (and popen_wr). --- lib/PublicInbox/LeiInput.pm | 13 + lib/PublicInbox/LeiRemote.pm | 14 ++ lib/PublicInbox/LeiXSearch.pm

[PATCH 08/13] lei_mirror: note missing local manifests are non-fatal

2023-11-09 Thread Eric Wong
Sometimes seeing that warning is alarming. --- lib/PublicInbox/LeiMirror.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/LeiMirror.pm b/lib/PublicInbox/LeiMirror.pm index 49febe9e..84266d03 100644 --- a/lib/PublicInbox/LeiMirror.pm +++

[PATCH 11/13] xapcmd: get rid of scalar wantarray popen_rd

2023-11-09 Thread Eric Wong
We can rely on Process::IO->attached_pid and work towards simplifying popen_rd. --- lib/PublicInbox/Xapcmd.pm | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/PublicInbox/Xapcmd.pm b/lib/PublicInbox/Xapcmd.pm index c2b66e69..69f0af43 100644 ---

[PATCH 07/13] net: retry on EINTR and check for {quit} flag

2023-11-09 Thread Eric Wong
This should allow us to detect shutdown signals in -watch more quickly and not unnecessarily fail on inconsequential signals such as SIGWINCH. --- lib/PublicInbox/NetNNTPSocks.pm | 1 + lib/PublicInbox/NetReader.pm| 53 +++-- lib/PublicInbox/Watch.pm| 2

[PATCH 09/13] ipc: simplify partial sendmsg fallback

2023-11-09 Thread Eric Wong
In the rare case sendmsg(2) isn't able to send the full amount (due to buffers >=2GB on Linux), use print + (autodie)close to send the remainder and retry on EINTR. `substr' should be able to avoid a large malloc via offsets and CoW on modern Perl. --- lib/PublicInbox/IPC.pm | 13 +++--

[PATCH 06/13] lei ls-mail-source: gracefully handle network failures

2023-11-09 Thread Eric Wong
All network connections may fail, so try to emit a helpful error message instead of attempting to dispatch methods off `undef'. --- lib/PublicInbox/LeiLsMailSource.pm | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/LeiLsMailSource.pm

[PATCH 00/13] misc error handling stuff and simplifications

2023-11-09 Thread Eric Wong
1-4 were things I noticed while chasing the lei SIGPIPE handling fix. 5-7 are things I noticed while testing on Dragonfly and NetBSD. 8 was noticed randomly while working on a new mirror, and the last few complete the work which let me get rid of tied IO handles in favor of using the

[PATCH 05/13] net_nntp_socks: more comments around how it works

2023-11-09 Thread Eric Wong
This is convoluted as hell but I can't figure out a better way to make Net::NNTP work with SOCKS. --- lib/PublicInbox/NetNNTPSocks.pm | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/PublicInbox/NetNNTPSocks.pm b/lib/PublicInbox/NetNNTPSocks.pm index

[PATCH 01/13] lei_xsearch: put query in process title for debugging

2023-11-09 Thread Eric Wong
Having queries in the process titles makes it easier to diagnose stuck queries due to IPC problems. This was used to diagnose commit e97a30e7624d (lei: fix SIGPIPE on large result sets to pager)). --- lib/PublicInbox/LeiXSearch.pm | 12 +++- 1 file changed, 7 insertions(+), 5

[PATCH 02/13] lei: use cached $daemon_pid when possible

2023-11-09 Thread Eric Wong
->lei_daemon_pid can only be called in the top-level daemon process when $daemon_pid is valid, so avoid a getpid(2) syscall in those cases. --- lib/PublicInbox/LEI.pm | 2 +- lib/PublicInbox/LeiUp.pm | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/LEI.pm

[PATCH 04/13] lei_up: use v5.12

2023-11-09 Thread Eric Wong
No unicode_strings dependencies here, AFAIK --- lib/PublicInbox/LeiUp.pm | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/LeiUp.pm b/lib/PublicInbox/LeiUp.pm index 0faa180d..9931f017 100644 --- a/lib/PublicInbox/LeiUp.pm +++ b/lib/PublicInbox/LeiUp.pm @@

[PATCH 03/13] lei: reuse FDs atfork and close explicitly

2023-11-09 Thread Eric Wong
We'll avoid having a redundant STDERR FD open in lei workers, and some explicit close() on `lei up' sockets reduces the likelyhood of inadvertantly open FDs causing processes to linger. --- lib/PublicInbox/LEI.pm | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git