Skip to content

Commit 552de63

Browse files
author
Andrei Neagu
committed
Merge remote-tracking branch 'upstream/master' into pr-osparc-s3-zip-stream-worker-code
2 parents 8badfd2 + b453ddc commit 552de63

File tree

3 files changed

+24
-13
lines changed

3 files changed

+24
-13
lines changed

services/storage/src/simcore_service_storage/modules/celery/_common.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import logging
2+
import ssl
23

34
from celery import Celery # type: ignore[import-untyped]
45
from settings_library.celery import CelerySettings
@@ -16,12 +17,14 @@ def create_app(celery_settings: CelerySettings) -> Celery:
1617
RedisDatabase.CELERY_TASKS,
1718
),
1819
)
20+
app.conf.broker_connection_retry_on_startup = True
21+
# NOTE: disable SSL cert validation (https://github.com/ITISFoundation/osparc-simcore/pull/7407)
22+
app.conf.redis_backend_use_ssl = {"ssl_cert_reqs": ssl.CERT_NONE}
1923
app.conf.result_expires = celery_settings.CELERY_RESULT_EXPIRES
2024
app.conf.result_extended = True # original args are included in the results
2125
app.conf.result_serializer = "json"
2226
app.conf.task_send_sent_event = True
2327
app.conf.task_track_started = True
2428
app.conf.worker_send_task_events = True # enable tasks monitoring
25-
app.conf.broker_connection_retry_on_startup = True
2629

2730
return app

services/web/server/src/simcore_service_webserver/trash/_rest.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,24 +50,23 @@ async def empty_trash(request: web.Request):
5050
user_id = get_user_id(request)
5151
product_name = products_web.get_product_name(request)
5252

53-
is_fired = asyncio.Event()
54-
55-
async def _empty_trash():
56-
is_fired.set()
57-
await _service.safe_empty_trash(
58-
request.app, product_name=product_name, user_id=user_id
59-
)
53+
explicitly_trashed_project_deleted = asyncio.Event()
6054

6155
fire_and_forget_task(
62-
_empty_trash(),
56+
_service.safe_empty_trash(
57+
request.app,
58+
product_name=product_name,
59+
user_id=user_id,
60+
on_explicitly_trashed_projects_deleted=explicitly_trashed_project_deleted,
61+
),
6362
task_suffix_name="rest.empty_trash",
6463
fire_and_forget_tasks_collection=request.app[APP_FIRE_AND_FORGET_TASKS_KEY],
6564
)
6665

67-
# NOTE: Ensures `fire_and_forget_task` is triggered; otherwise,
68-
# when the front-end requests the trash item list,
66+
# NOTE: Ensures `fire_and_forget_task` is triggered and deletes explicit projects;
67+
# otherwise, when the front-end requests the trash item list,
6968
# it may still display items, misleading the user into
7069
# thinking the `empty trash` operation failed.
71-
await is_fired.wait()
70+
await explicitly_trashed_project_deleted.wait()
7271

7372
return web.json_response(status=status.HTTP_204_NO_CONTENT)

services/web/server/src/simcore_service_webserver/trash/_service.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import asyncio
12
import logging
23
from datetime import timedelta
34
from typing import Final
@@ -100,10 +101,18 @@ async def _empty_explicitly_trashed_folders_and_content(
100101

101102

102103
async def safe_empty_trash(
103-
app: web.Application, *, product_name: ProductName, user_id: UserID
104+
app: web.Application,
105+
*,
106+
product_name: ProductName,
107+
user_id: UserID,
108+
on_explicitly_trashed_projects_deleted: asyncio.Event | None = None
104109
):
110+
# Delete explicitly trashed projects & notify
105111
await _empty_explicitly_trashed_projects(app, product_name, user_id)
112+
if on_explicitly_trashed_projects_deleted:
113+
on_explicitly_trashed_projects_deleted.set()
106114

115+
# Delete explicitly trashed folders (and all implicitly trashed sub-folders and projects)
107116
await _empty_explicitly_trashed_folders_and_content(app, product_name, user_id)
108117

109118

0 commit comments

Comments
 (0)