added keyword args instead of postional for execute monitor logic

This commit is contained in:
tpv committed 2026-06-30 19:37:01 -07:00
1 parent 8f86e85c50
commit 6025393ad4
2 files changed
+9 -5

No files matched your search

+6 -4
View File
@@ -60,12 +60,11 @@ async def add_products_to_database(
new_price is not None and new_price < old_price
)
set_on_insert = {"discoveredDate": datetime.now(timezone.utc)}
if price_dropped:
document["status"] = STATUS_PENDING
document["priceBeforeDrop"] = old_price
set_on_insert = {"discoveredDate": datetime.now(timezone.utc)}
if not price_dropped:
else:
set_on_insert["status"] = STATUS_PENDING
ops.append(
@@ -79,7 +78,10 @@ async def add_products_to_database(
try:
await collection.bulk_write(ops, ordered=False)
except PyMongoError:
LOGGER.exception(f"{category_identifier} - failed to add products to database")
LOGGER.exception(
"failed to add products to database",
extra={"category": category_identifier},
)
raise
+3 -1
View File
@@ -135,9 +135,10 @@ def build_product_details(
async def execute_monitor_logic(
proxies: AioProxies,
category_identifiers: list[str] | dict[str, str],
task_func: Callable[..., Awaitable[None]],
*,
proxies: AioProxies,
headers: dict | None = None,
cookies: dict | None = None,
pre_task_func: Callable[..., Awaitable[None]] | None = None,
@@ -203,6 +204,7 @@ async def execute_pagination(
products_per_page: int,
func: Callable[..., Awaitable[None]],
session: aiohttp.ClientSession | AsyncSession,
*,
max_concurrent_tasks: int = 5,
start_offset: int = 24,
pagination_mode: str = "offset",