mirror of
https://github.com/wahyd4/links.git
synced 2026-08-15 08:06:27 +10:00
Increase task timeout because machine isn't powerful enough
This commit is contained in:
+4
-2
@@ -13,6 +13,8 @@ import time
|
||||
from celery.exceptions import MaxRetriesExceededError
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
SCREENSHOT_TIMEOUT = 20
|
||||
FETCH_PAGE_TIMEOUT = 15
|
||||
|
||||
def fibonacci(n):
|
||||
if n <= 0:
|
||||
@@ -81,7 +83,7 @@ def capture_screenshot(self, page_id):
|
||||
)
|
||||
|
||||
try:
|
||||
driver.set_page_load_timeout(10)
|
||||
driver.set_page_load_timeout(SCREENSHOT_TIMEOUT)
|
||||
driver.get(page.url)
|
||||
time.sleep(2) # Wait for dynamic content
|
||||
|
||||
@@ -138,7 +140,7 @@ def process_page(self, page_id):
|
||||
'Accept-Language': 'en-US,en;q=0.5',
|
||||
}
|
||||
|
||||
response = requests.get(page.url, headers=headers, timeout=10, verify=False)
|
||||
response = requests.get(page.url, headers=headers, timeout=FETCH_PAGE_TIMEOUT, verify=False)
|
||||
response.raise_for_status()
|
||||
|
||||
if response.encoding == 'ISO-8859-1':
|
||||
|
||||
Reference in New Issue
Block a user