Speed up daily reindex: skip empty JSON rewrites and upsert only changed posts.

Keep channel mtime stable when merge finds no new posts, and rebuild FTS only
for new/changed content so large daily channels stay cheap. Drop --reindex-all
from renew.sh for incremental runs.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Сергей Маринкевич
2026-08-04 18:31:15 +07:00
parent 0b87a1b339
commit 4820fb884b
3 changed files with 175 additions and 58 deletions
+4
View File
@@ -624,6 +624,10 @@ def export_channel(d: Driver, channel: str, user_id_to_name: Dict[str, str], out
merged_posts.append(post)
seen_ids.add(post["id"])
new_count += 1
if new_count == 0:
# Keep mtime stable so mm_index can skip this channel file.
print(f" no new posts, leaving '{output_filepath}' unchanged")
return
merged_posts.sort(key=lambda p: p["created"])
for i, post in enumerate(merged_posts):
post["idx"] = i