fix race in rpc heartbeat test