Private
Public Access
Batch feed ingestion, add a readiness check, fail open without Redis (C2, C8)
Ingestion did a get_or_create per entry. It now prefetches existing articles for the poll in one query, bulk-inserts new ones and bulk-updates changed ones (falling back to row-by-row only if a concurrent fetch wins a race), and dispatches rule evaluation in bounded chunks so a huge first fetch is several small tasks. /health/ stays a DB-only liveness check (upgrade.sh gates on it right after restart). New /health/ready/ also checks Redis and that poll_due_feeds ticked within five minutes — proving beat and a worker are both alive — and returns 503 with per-check detail otherwise. The sidebar unread-count cache and login throttle now degrade instead of erroring when Redis is unreachable: every authenticated page and every login would otherwise 500 during a cache outage. Found while verifying in a sandbox with no Redis. Also includes the dashboard's oldest-article metric (core/views.py). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8d2900424a
commit
e5f1277014
14 files changed
+354
-48
No files matched your search
@@ -72,3 +72,21 @@ def test_too_many_failed_attempts_against_one_username_blocks_that_username(clie
|
||||
response = client.post(reverse("accounts:login"), {"username": "bob", "password": "pw-bob-123"})
|
||||
assert response.status_code == 302
|
||||
assert response.wsgi_request.user == bob
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_login_still_works_when_the_throttle_cache_is_down(client, monkeypatch):
|
||||
from unittest.mock import Mock
|
||||
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
get_user_model().objects.create_user("alice", password="pw-alice-123")
|
||||
broken = Mock(side_effect=ConnectionError("redis down"))
|
||||
monkeypatch.setattr("apps.accounts.views.cache.get", broken)
|
||||
monkeypatch.setattr("apps.accounts.views.cache.incr", broken)
|
||||
monkeypatch.setattr("apps.accounts.views.cache.set", broken)
|
||||
|
||||
bad = client.post(reverse("accounts:login"), {"username": "alice", "password": "wrong"})
|
||||
assert bad.status_code == 200
|
||||
good = client.post(reverse("accounts:login"), {"username": "alice", "password": "pw-alice-123"})
|
||||
assert good.status_code == 302
|
||||
Reference in new issue
Block a user