Logic to figure out when to snapshot.