diff --git a/src/calibre/srv/content.py b/src/calibre/srv/content.py index 6107184248..2fe64f7933 100644 --- a/src/calibre/srv/content.py +++ b/src/calibre/srv/content.py @@ -43,6 +43,10 @@ mtimes = {} rename_counter = 0 +def reset_caches(): + mtimes.clear() + + def open_for_write(fname): try: return share_open(fname, 'w+b') diff --git a/src/calibre/srv/embedded.py b/src/calibre/srv/embedded.py index 3f5ff38a78..ecabba3f62 100644 --- a/src/calibre/srv/embedded.py +++ b/src/calibre/srv/embedded.py @@ -83,11 +83,13 @@ class Server(object): def serve_forever(self): self.exception = None + from calibre.srv.content import reset_caches if self.state_callback is not None: try: self.state_callback(True) except Exception: pass + reset_caches() # we reset the cache as the server tdir has changed try: self.loop.serve_forever() except BaseException as e: