Replace brittle timeout with a background heartbeat thread

@thieman 


Yeah. If the main thread dies, we want the whole thing to die so supervisor can try to restart it.