cluster

Infrastructure files for Nordgedanken and Midnightthoughts.
git clone git://archive.git.mtrnord.blog/MTRNord/cluster.git
Log | Files | Refs | README

commit 34eccfad6268f3aecbe294d078088e21024629ee
parent 0a75abf6615449095611ba9c443fe5c48981b21a
Author: MTRNord <MTRNord@users.noreply.github.com>
Date:   Sat,  4 Apr 2026 12:05:45 +0200

fix catchup code

Signed-off-by: MTRNord <MTRNord@users.noreply.github.com>

Diffstat:
Mapps/talos_cluster/matrix-backup/backup-tool/main.go | 26++++++++++++++++++++++++++
1 file changed, 26 insertions(+), 0 deletions(-)

diff --git a/apps/talos_cluster/matrix-backup/backup-tool/main.go b/apps/talos_cluster/matrix-backup/backup-tool/main.go @@ -1659,6 +1659,32 @@ func backupAccount(ctx context.Context, acc accountCfg) error { } } + // Catch-up: DM rooms absent from this sync delta (no new events) may still + // need their history backfilled if they were first seen before getDMRooms worked. + for roomID := range dmRooms { + if _, inSync := syncResp.Rooms.Join[roomID]; inSync { + continue // already handled above + } + safeKey := strings.NewReplacer("/", "_", ":", "_").Replace(string(roomID)) + dmHistoryDoneKey := acc.Prefix + "/history-cursor/" + safeKey + ".dm-done" + dmDone, _ := s3Get(ctx, dmHistoryDoneKey) + if dmDone != nil { + continue // already backfilled + } + cursorKey := acc.Prefix + "/history-cursor/" + safeKey + ".json" + var cursor struct { + Token string `json:"token"` + } + _ = s3GetJSON(ctx, cursorKey, &cursor) + if cursor.Token == "" { + continue // never seen this room; will be handled on first sync that includes it + } + slog.Info("DM catch-up for room not in current sync", "room_id", roomID) + if err := paginateRoom(ctx, client, roomID, acc.Prefix, true, cursor.Token, syncResp.NextBatch, sessions); err != nil { + slog.Warn("DM catch-up error", "room_id", roomID, "error", err) + } + } + if err := uploadStore(ctx, acc.StoreDir, storeS3Key); err != nil { slog.Warn("Could not upload store", "error", err) }