~geb/sup

20fce7724830fd5cb215b16b1b0f1a498d6165c0 — John Gebbie 1 year, 10 months ago a7d36bf
cache next_batch after rooms
1 files changed, 3 insertions(+), 7 deletions(-)

M storage.go
M storage.go => storage.go +3 -7
@@ 55,12 55,6 @@ func saveStorer(storer *mautrix.InMemoryStore, user id.UserID) error {
		return err
	}

	nb := storer.LoadNextBatch(user)
	err = os.WriteFile(filepath.Join(dir, "next_batch"), []byte(nb), 0600)
	if err != nil {
		return err
	}

	var rooms bytes.Buffer
	err = gob.NewEncoder(&rooms).Encode(storer.Rooms)
	if err != nil {


@@ 70,7 64,9 @@ func saveStorer(storer *mautrix.InMemoryStore, user id.UserID) error {
	if err != nil {
		return err
	}
	return nil

	nb := storer.LoadNextBatch(user)
	return os.WriteFile(filepath.Join(dir, "next_batch"), []byte(nb), 0600)
}

func loadDirectChats(user id.UserID) (map[id.RoomID]id.UserID, error) {