Skip to content

Commit cc12cee

Browse files
committed
make notification optional when deleting the project
1 parent a8c2ab2 commit cc12cee

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

services/web/server/src/simcore_service_webserver/projects/projects_api.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ async def delete_project(app: web.Application, project_uuid: str, user_id: int)
178178
await delete_project_from_db(app, project_uuid, user_id)
179179

180180
async def remove_services_and_data():
181-
await remove_project_interactive_services(user_id, project_uuid, app)
181+
await remove_project_interactive_services(
182+
user_id, project_uuid, app, notify_users=False
183+
)
182184
await delete_project_data(app, project_uuid, user_id)
183185

184186
fire_and_forget_task(remove_services_and_data())
@@ -195,9 +197,7 @@ async def retrieve_and_notify_project_locked_state(
195197

196198

197199
async def remove_project_interactive_services(
198-
user_id: int,
199-
project_uuid: str,
200-
app: web.Application,
200+
user_id: int, project_uuid: str, app: web.Application, notify_users: bool = True
201201
) -> None:
202202
# NOTE: during the closing process, which might take awhile,
203203
# the project is locked so no one opens it at the same time
@@ -214,8 +214,10 @@ async def remove_project_interactive_services(
214214
user_id,
215215
await get_user_name(app, user_id),
216216
):
217-
# notify
218-
await retrieve_and_notify_project_locked_state(user_id, project_uuid, app)
217+
if notify_users:
218+
await retrieve_and_notify_project_locked_state(
219+
user_id, project_uuid, app
220+
)
219221

220222
# save the state if the user is not a guest. if we do not know we save in any case.
221223
with suppress(director_exceptions.DirectorException):
@@ -244,7 +246,8 @@ async def remove_project_interactive_services(
244246
)
245247
finally:
246248
# notify when done and the project is closed
247-
await retrieve_and_notify_project_locked_state(user_id, project_uuid, app)
249+
if notify_users:
250+
await retrieve_and_notify_project_locked_state(user_id, project_uuid, app)
248251

249252

250253
async def delete_project_data(

services/web/server/src/simcore_service_webserver/projects/projects_handlers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ async def delete_project(request: web.Request):
344344
project_users = {
345345
uid
346346
for uid, _ in await rt.find_users_of_resource(
347-
"project_id", project_uuid
347+
PROJECT_ID_KEY, project_uuid
348348
)
349349
}
350350
# that project is still in use

0 commit comments

Comments
 (0)