cryptoboid / splitio

split your bills easily! splitio is an open-source webapp built for tracking debts and payments quickly, without any user accounts. works as a splitwise-clone
https://splitio.vercel.app/
GNU Affero General Public License v3.0
88 stars 13 forks source link

Question: How does gun persistence work? #16

Open chmac opened 2 years ago

chmac commented 2 years ago

Partly from #4, I'm realising that I have old groups which I can no longer access. The inspector just shows "loading" for the gun status, and the groups won't load on any of my browsers (including several which had loaded the groups previously).

I'm a bit unclear on how gun persistence actually works. In theory, should every record ever stored be kept forever? Or is it more like ipfs where unless a node persists the data then it will slowly age out of caches and disappear?

I'm thinking it would be neat to figure out how to communicate the persistence part clearly and then add it to the app somewhere so folks can understand what's going on with the data.

cryptoboid commented 2 years ago

That's a great question, which I also want to know the answer 😅 The docs are kinda chaotic (https://gun.eco/docs/DAM). I've switched from localStorage to indexedDB, so it should be a bit more resilient (eviction policies depend on each browser).

Also, I'm not sure how Gun syncs when you have more than 1 relay like splitio: does it sync with everyone? round-robin? if it fails, how many times does it retry? I've tried looking at the code but, well: https://github.com/amark/gun/blob/master/src/put.js not really straightforward 😵‍💫

I'm thinking it would be neat to figure out how to communicate the persistence part clearly and then add it to the app somewhere so folks can understand what's going on with the data.

I've added a "sync issues" dialog on the group page as a first step. I wouldn't enter in too much detail though, so non-tech people can understand it easily (open to suggestions!)