Do not send project closed event when it's a snapshot restore

Ref #602
This commit is contained in:
Julien Duponchelle committed 2016-08-15 13:30:02 +02:00
1 parent 937ffc7b73
commit 431bd789cb
3 files changed
+11 -4

No files matched your search

+3 -2
View File
@@ -440,12 +440,13 @@ class Project:
os.remove(snapshot.path)
@asyncio.coroutine
def close(self):
def close(self, ignore_notification=False):
for compute in self._project_created_on_compute:
yield from compute.post("/projects/{}/close".format(self._id))
self._cleanPictures()
self._status = "closed"
self.controller.notification.emit("project.closed", self.__json__())
if not ignore_notification:
self.controller.notification.emit("project.closed", self.__json__())
def _cleanPictures(self):
"""
+2 -1
View File
@@ -77,7 +77,8 @@ class Snapshot:
"""
yield from self._project.delete_on_computes()
yield from self._project.close()
# We don't send close notif to clients because the close / open dance is purely internal
yield from self._project.close(ignore_notification=True)
shutil.rmtree(os.path.join(self._project.path, "project-files"))
with open(self._path, "rb") as f:
project = yield from import_project(self._project.controller, self._project.id, f, location=self._project.path)