Task loop to issue query tasks at the right times.

async def _scheduleLoop(self):
        '''
        Task loop to issue query tasks at the right times.
        '''
        while True:
            try:
                timeout = None if not self.apptheap else self.apptheap[0].nexttime - time.time()
                if timeout is None or timeout >= 0.0:
                    await asyncio.wait_for(self._wake_event.wait(), timeout=timeout)
            except asyncio.TimeoutError:
                pass
            if self.isfini:
                return
            self._wake_event.clear()

            now = time.time()
            while self.apptheap and self.apptheap[0].nexttime <= now:
                appt = heapq.heappop(self.apptheap)
                appt.updateNexttime(now)
                if appt.nexttime:
                    heapq.heappush(self.apptheap, appt)
                if not appt.enabled:
                    continue
                if appt.isrunning:
                    logger.warning(
                        'Appointment %s is still running from previous time when scheduled to run.  Skipping.',
                        appt.iden)
                else:
                    await self._execute(appt)