new relay: fix bugs with host cursor, lastSeq, and status tracking (#1068)
Ended up being a bigger batch of changes than I hoped, but did also
knock off some adjacent cleanups.
The fixes:
- the key thing is to update the cursor variable in the redial loop: the
lastSeq code had mostly been refactored, but missed this bit, where the
variable was getting updated via pointer from deep in other functions.
stop passing the pointer around, and instead use the `sub.UpdateSeq()` /
`sub.LastSeq` info to determine if cursor made progress before looping
- we were handling FutureCursor really aggressively: reseting the
database-persisted cursor in the relay. I think this is too aggressive
for automation; a host might restart in a weird state for a minute, then
come back later with the original seq (for example). Having relay just
disconnect for now
- if we see new valid events for a host, we now mark that host as
"active" (which prevents states like "offline" from being sticky even
after successful requestCrawl and updates)
- don't pass through `newHost`, just use the `lastSeq` as indicator of
whether to connect at "current cursor" or some previous cursor