Optimizing scheduled messages handling