put events while offline never get synced
Code to recreate - based on basic/note example:
const peers = ['https://gun-manhattan.herokuapp.com/gun', 'https://try.axe.eco/gun', 'https://test.era.eco/gun']
const gun = Gun(peers)
const pad = gun.get(location.hash.slice(1) || 'default')
addEventListener('online', () => {gun.opt(peers); pad.get('heartbeat').put('heartbeat')})
textarea.addEventListener('input', () => pad.put({content: textarea.value}))
pad.on(data => textarea.value = data.content)
The line with the online event reconnects the gun and the heartbeat allows the reconnected client to receive the missed "on" events.
However, the put events that happened in the offline client never get synced (even if these were the only events in the network). In this state the graphs are not consistent, and I could not find a way to explicitly check the sync status/diff or force the sync in this direction.
@amark
maybe dupe of https://github.com/amark/gun/issues/259 ?
@eyaler thanks for bumping this.
offline re-sync code is here: https://github.com/amark/gun/blob/master/src/mesh.js#L337-L341
@draeder brought this to my attention (github's notification are broken so I don't see things unless people contact me) I'd deeply appreciate if you or him could tackle it, or fix it somewhere else from scratch. 1st step is having a PANIC test to run that simulates offline conditions (several already do, check https://github.com/amark/gun/blob/master/test/panic/load.js for a tutorial & starting template) to replicate the bug: because I know its not as simple as "offline changes don't sync" (many do sync) so there's something more complicated going on.