perf: viewport 1366x768 + flag-uri de reducere overhead in Session 0
Pe prod scraper-ul ruleaza ca serviciu in Session 0 (fara GPU): Chromium randeaza software. Reducerea viewport-ului de la 1920x1080 la 1366x768 inseamna ~50% mai putini pixeli de rasterizat. 1366 e sigur peste pragul de ~1100px sub care BT scoate splash-ul "redirect to store". Adaugate flag-uri care taie overhead inutil fara GPU: --disable-gpu, --disable-dev-shm-usage, --disable-extensions, --disable-background-networking, --disable-renderer-backgrounding, --disable-features=Translate. Verificat e2e pe site-ul BT live la 1366px (formular login real, fara splash) si printr-o rulare completa prin bot: 5 conturi, 5 CSV-uri. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -385,13 +385,23 @@ class BTGoScraper:
|
|||||||
logging.info("=" * 60)
|
logging.info("=" * 60)
|
||||||
|
|
||||||
with sync_playwright() as p:
|
with sync_playwright() as p:
|
||||||
# Forteaza dimensiunea ferestrei la nivel de SO. Necesar cand
|
# Viewport 1366x768: BT afiseaza un splash "redirect to store"
|
||||||
# scraper-ul ruleaza dintr-un Windows Service in session 0 (fara
|
# sub ~1100px latime; 1366 e sigur peste prag. Fata de 1920x1080
|
||||||
# display): viewport-ul setat pe context (CSS) nu se propaga la
|
# randeaza ~50% mai putini pixeli -> CPU mult mai mic la randarea
|
||||||
# fereastra fizica, iar BT afiseaza un splash "redirect to store"
|
# software din Session 0 (serviciu Windows, fara GPU).
|
||||||
# sub ~1100px care ascunde input#user.
|
# --window-size forteaza dimensiunea la nivel de SO (viewport-ul
|
||||||
launch_args = ['--window-size=1920,1080']
|
# CSS de context nu se propaga la fereastra fizica in session 0).
|
||||||
context_kwargs = {'viewport': {'width': 1920, 'height': 1080}}
|
launch_args = [
|
||||||
|
'--window-size=1366,768',
|
||||||
|
# Flag-uri care taie overhead inutil in Session 0 (fara GPU)
|
||||||
|
'--disable-gpu',
|
||||||
|
'--disable-dev-shm-usage',
|
||||||
|
'--disable-extensions',
|
||||||
|
'--disable-background-networking',
|
||||||
|
'--disable-renderer-backgrounding',
|
||||||
|
'--disable-features=Translate',
|
||||||
|
]
|
||||||
|
context_kwargs = {'viewport': {'width': 1366, 'height': 768}}
|
||||||
|
|
||||||
if self.config.HEADLESS:
|
if self.config.HEADLESS:
|
||||||
# Playwright 1.48: headless=True foloseste VECHIUL mod headless,
|
# Playwright 1.48: headless=True foloseste VECHIUL mod headless,
|
||||||
|
|||||||
Reference in New Issue
Block a user