diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py index 601aee4..bf3a002 100644 --- a/tests/test_scheduler.py +++ b/tests/test_scheduler.py @@ -8,14 +8,14 @@ class TestScheduler: def test_scrape_jobs_with_retry_success(self): """Test that scrape_jobs_with_retry succeeds on first attempt.""" - with patch('web.craigslist.scrape_jobs') as mock_scrape: + with patch('web.craigslist.scraper') as mock_scrape: result = scrape_jobs_with_retry() assert result is True mock_scrape.assert_called_once() def test_scrape_jobs_with_retry_failure(self): """Test that scrape_jobs_with_retry handles failures properly.""" - with patch('web.craigslist.scrape_jobs', side_effect=Exception("Test error")) as mock_scrape: + with patch('web.craigslist.scraper', side_effect=Exception("Test error")) as mock_scrape: result = scrape_jobs_with_retry(max_retries=2) assert result is False assert mock_scrape.call_count == 2 diff --git a/web/craigslist.py b/web/craigslist.py index 8e10e86..5bed0c8 100644 --- a/web/craigslist.py +++ b/web/craigslist.py @@ -174,7 +174,7 @@ def scrape_jobs_with_retry(max_retries=3): return True except Exception as e: if attempt < max_retries - 1: - time.sleep(2 ** attempt * 60) # Exponential backoff + time.sleep(2 ** attempt * 10) # Exponential backoff return False