Add attempt_initial_sync and update sync logic

This commit is contained in:
thePR0M3TH3AN
2025-07-17 15:00:38 -04:00
parent 1f7c538015
commit dfa85ad863
4 changed files with 32 additions and 13 deletions

View File

@@ -47,7 +47,8 @@ def test_full_sync_roundtrip(dummy_nostr_client):
manifest_id = relay.manifests[-1].id
# Manager B retrieves snapshot
pm_b.sync_index_from_nostr_if_missing()
result = pm_b.attempt_initial_sync()
assert result is True
entries = pm_b.entry_manager.list_entries()
assert [e[1] for e in entries] == ["site1"]

View File

@@ -47,7 +47,8 @@ def test_full_sync_roundtrip(dummy_nostr_client):
manifest_id = relay.manifests[-1].id
# Manager B retrieves snapshot
pm_b.sync_index_from_nostr_if_missing()
result = pm_b.attempt_initial_sync()
assert result is True
entries = pm_b.entry_manager.list_entries()
assert [e[1] for e in entries] == ["site1"]

View File

@@ -81,6 +81,7 @@ def test_sync_index_missing_bad_data(monkeypatch, dummy_nostr_client):
)
monkeypatch.setattr(client, "fetch_deltas_since", lambda *_a, **_k: [])
pm.sync_index_from_nostr_if_missing()
data = pm.vault.load_index()
assert data["entries"] == {}
result = pm.attempt_initial_sync()
assert result is False
index_path = dir_path / "seedpass_entries_db.json.enc"
assert not index_path.exists()