Skip to content

Commit c6a81f8

Browse files
committed
rm dependency with products domain
1 parent ba49cf5 commit c6a81f8

File tree

4 files changed

+19
-5
lines changed

4 files changed

+19
-5
lines changed

.env-devel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ WB_GC_LOGIN=null
288288
WB_GC_LOGLEVEL=INFO
289289
WB_GC_NOTIFICATIONS=0
290290
WB_GC_PAYMENTS=null
291-
WB_GC_PRODUCTS=1
291+
WB_GC_PRODUCTS=0
292292
WB_GC_PROJECTS=null
293293
WB_GC_PUBLICATIONS=0
294294
WB_GC_RESOURCE_MANAGER_RESOURCE_TTL_S=60

services/web/server/src/simcore_service_webserver/products/_api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
4550
async def get_current_product_credit_price_info(
4651
request: web.Request,
4752
) -> ProductPriceInfo | None:

services/web/server/src/simcore_service_webserver/products/_db.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,13 @@ async def iter_products(conn: SAConnection) -> AsyncIterator[ResultProxy]:
8686

8787

8888
class 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(

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)