diff options
author | Eric Wong <e@yhbt.net> | 2020-06-15 07:43:17 +0000 |
---|---|---|
committer | Eric Wong <e@yhbt.net> | 2020-06-16 00:07:05 +0000 |
commit | 01f2e00be4671e1100b6180310c0fd8c0035ebc8 (patch) | |
tree | 7a6a2b78e222b4c7ec524b7e7e45046b1659e3ff /lib/PublicInbox | |
parent | 97cb0db690cc2065e7e3c33ea5f3636dc0b538c5 (diff) | |
download | public-inbox-01f2e00be4671e1100b6180310c0fd8c0035ebc8.tar.gz |
Since IMAP IDLE users aren't expected to issue any commands, we can terminate their connections immediately on graceful shutdown. Furthermore, we need to drop the inotify FD from the epoll set to avoid warnings during global destruction. Embarassingly, this required fixing wacky test ordering from 2a717d13f10fcdc6 ("nntpd+imapd: detect replaced over.sqlite3")
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/IMAP.pm | 4 | ||||
-rw-r--r-- | lib/PublicInbox/InboxIdle.pm | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/PublicInbox/IMAP.pm b/lib/PublicInbox/IMAP.pm index 9ae7c60e..d4ef6efe 100644 --- a/lib/PublicInbox/IMAP.pm +++ b/lib/PublicInbox/IMAP.pm @@ -1462,6 +1462,10 @@ sub cmd_starttls ($$) { # for graceful shutdown in PublicInbox::Daemon: sub busy { my ($self, $now) = @_; + if (defined($self->{-idle_tag})) { + $self->write(\"* BYE server shutting down\r\n"); + return; # not busy anymore + } ($self->{rbuf} || $self->{wbuf} || $self->not_idle_long($now)); } diff --git a/lib/PublicInbox/InboxIdle.pm b/lib/PublicInbox/InboxIdle.pm index d60d4f23..d0bb43c5 100644 --- a/lib/PublicInbox/InboxIdle.pm +++ b/lib/PublicInbox/InboxIdle.pm @@ -79,4 +79,8 @@ sub event_step { warn "$self->{inot}->poll err: $@\n" if $@; } +# for graceful shutdown in PublicInbox::Daemon, +# just ensure the FD gets closed ASAP and subscribers +sub busy { 0 } + 1; |