From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 3/4] *index: discard sync->{todo} on iteration
Date: Fri, 13 Nov 2020 11:11:43 +0000 [thread overview]
Message-ID: <20201113111144.23038-4-e@80x24.org> (raw)
In-Reply-To: <20201113111144.23038-1-e@80x24.org>
There's no need to continuously append to {todo} when indexing
multiple inboxes. They're not redundantly indexed (because the
IdxStack is discarded, making it a noop), but it's still a waste
of memory keeping the $unit hashrefs around.
---
lib/PublicInbox/ExtSearchIdx.pm | 2 +-
lib/PublicInbox/V2Writable.pm | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm
index 2d230dc1..6c09c460 100644
--- a/lib/PublicInbox/ExtSearchIdx.pm
+++ b/lib/PublicInbox/ExtSearchIdx.pm
@@ -308,7 +308,7 @@ sub _sync_inbox ($$$) {
warn "E: $ekey unsupported inbox version (v$v)\n";
return;
}
- index_todo($self, $sync, $_) for @{$sync->{todo}};
+ index_todo($self, $sync, $_) for @{delete($sync->{todo}) // []};
}
sub eidx_sync { # main entry point
diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm
index cf44c95b..11cde627 100644
--- a/lib/PublicInbox/V2Writable.pm
+++ b/lib/PublicInbox/V2Writable.pm
@@ -1351,7 +1351,7 @@ sub index_sync {
}
}
# work forwards through history
- index_todo($self, $sync, $_) for @{$sync->{todo}};
+ index_todo($self, $sync, $_) for @{delete($sync->{todo}) // []};
$self->{oidx}->rethread_done($opt);
$self->done;
next prev parent reply other threads:[~2020-11-13 11:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 11:11 [PATCH 0/4] extindex: checkpoints, graceful shutdown, cleanups Eric Wong
2020-11-13 11:11 ` [PATCH 1/4] *index: checkpoints write last_commit metadata Eric Wong
2020-11-13 11:11 ` [PATCH 2/4] *index: avoid per-epoch --batch-check processes Eric Wong
2020-11-13 12:38 ` Kyle Meyer
2020-11-15 3:03 ` Eric Wong
2020-11-13 11:11 ` Eric Wong [this message]
2020-11-13 11:11 ` [PATCH 4/4] extindex: support graceful shutdown via QUIT/INT/TERM Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201113111144.23038-4-e@80x24.org \
--to=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).