@@ -50,24 +50,23 @@ async def empty_trash(request: web.Request):
50
50
user_id = get_user_id (request )
51
51
product_name = products_web .get_product_name (request )
52
52
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 ()
60
54
61
55
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
+ ),
63
62
task_suffix_name = "rest.empty_trash" ,
64
63
fire_and_forget_tasks_collection = request .app [APP_FIRE_AND_FORGET_TASKS_KEY ],
65
64
)
66
65
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,
69
68
# it may still display items, misleading the user into
70
69
# thinking the `empty trash` operation failed.
71
- await is_fired .wait ()
70
+ await explicitly_trashed_project_deleted .wait ()
72
71
73
72
return web .json_response (status = status .HTTP_204_NO_CONTENT )
0 commit comments