Send heartbeat only when necessary