optimisation: reduce calls to task proxies to retrieve db operations

Minor refactoring of code in `scheduler.py` (and addition in task.py of a relevant flag) that removes unnecessary extra iterating over task proxies and checking for new messages.

Seems to give minor reductions in load average and CPU used by the test battery.

@hjoliver - please review.