Skip to content

Commit

Permalink
auto: more reliable rebuild queue
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Sep 7, 2018
1 parent e13cce2 commit 60a40a4
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions nikola/plugins/command/auto/__init__.py
Expand Up @@ -245,7 +245,7 @@ def _execute(self, options, args):
# Run the event loop forever and handle shutdowns.
try:
# Run rebuild queue
loop.run_until_complete(self.run_rebuild_queue())
queue_future = asyncio.ensure_future(self.run_rebuild_queue())

self.dns_sd = dns_sd(port, (options['ipv6'] or '::' in host))
loop.run_forever()
Expand All @@ -255,8 +255,8 @@ def _execute(self, options, args):
self.logger.info("Server is shutting down.")
if self.dns_sd:
self.dns_sd.Reset()
queue_future.cancel()
srv.close()
loop.run_until_complete(self.rebuild_queue.put((None, None)))
loop.run_until_complete(srv.wait_closed())
loop.run_until_complete(webapp.shutdown())
loop.run_until_complete(handler.shutdown(5.0))
Expand Down Expand Up @@ -291,9 +291,6 @@ def run_rebuild_queue(self):
"""Run rebuilds from a queue (Nikola can only build in a single instance)."""
while True:
date, event_path = yield from self.rebuild_queue.get()
if date is None:
# Shutdown queue
return
if date < (self.last_rebuild + self.delta_last_rebuild):
self.logger.debug("Skipping rebuild from {0} (within delta)".format(event_path))
continue
Expand Down

0 comments on commit 60a40a4

Please sign in to comment.