File tree Expand file tree Collapse file tree 4 files changed +19
-5
lines changed
services/web/server/src/simcore_service_webserver Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -288,7 +288,7 @@ WB_GC_LOGIN=null
288288WB_GC_LOGLEVEL=INFO
289289WB_GC_NOTIFICATIONS=0
290290WB_GC_PAYMENTS=null
291- WB_GC_PRODUCTS=1
291+ WB_GC_PRODUCTS=0
292292WB_GC_PROJECTS=null
293293WB_GC_PUBLICATIONS=0
294294WB_GC_RESOURCE_MANAGER_RESOURCE_TTL_S=60
Original file line number Diff line number Diff line change @@ -42,6 +42,11 @@ def list_products(app: web.Application) -> list[Product]:
4242 return products
4343
4444
45+ async def list_products_names (app : web .Application ) -> list [ProductName ]:
46+ repo = ProductRepository .create_from_app (app )
47+ return await repo .list_products_names ()
48+
49+
4550async def get_current_product_credit_price_info (
4651 request : web .Request ,
4752) -> ProductPriceInfo | None :
Original file line number Diff line number Diff line change @@ -86,6 +86,13 @@ async def iter_products(conn: SAConnection) -> AsyncIterator[ResultProxy]:
8686
8787
8888class ProductRepository (BaseRepository ):
89+ async def list_products_names (self ) -> list [ProductName ]:
90+ async with self .engine .acquire () as conn :
91+ query = sa .select (products .c .name ).order_by (products .c .priority )
92+ result = await conn .execute (query )
93+ rows = await result .fetchall ()
94+ return [ProductName (row .name ) for row in rows ]
95+
8996 async def get_product (self , product_name : str ) -> Product | None :
9097 async with self .engine .acquire () as conn :
9198 result : ResultProxy = await conn .execute (
Original file line number Diff line number Diff line change @@ -112,28 +112,30 @@ async def safe_delete_expired_trash_as_admin(app: web.Application) -> None:
112112 retention = timedelta (days = settings .TRASH_RETENTION_DAYS )
113113 delete_until = arrow .now ().datetime - retention
114114
115- for product in products_service .list_products (app ):
115+ app_products_names = await products_service .list_products_names (app )
116+
117+ for product_name in app_products_names :
116118
117119 ctx = {
118120 "delete_until" : delete_until ,
119121 "retention" : retention ,
120- "product_name" : product . name ,
122+ "product_name" : product_name ,
121123 }
122124
123125 with log_context (
124126 _logger ,
125127 logging .DEBUG ,
126128 "Deleting items marked as trashed before %s in %s [trashed_at < %s will be deleted]" ,
127129 retention ,
128- product . display_name ,
130+ product_name ,
129131 delete_until ,
130132 ):
131133 try :
132134
133135 await folders_trash_service .batch_delete_trashed_folders_as_admin (
134136 app ,
135137 trashed_before = delete_until ,
136- product_name = product . name ,
138+ product_name = product_name ,
137139 fail_fast = False ,
138140 )
139141
You can’t perform that action at this time.
0 commit comments