[minor] scheduler writes heartbeat to DB in a goroutine to avoid blocking
[minor] remove heartbeat prefetch in scheduler
[minor] scheduler calls multi agent detection in goroutine to prevent blocking
[medium] make max number of DB connections configurable in scheduler