Spaces:
Running
Running
Commit ·
eff82c8
1
Parent(s): 340c40c
Fix Firebase init deadlock and ignore service-account keys
Browse filesfs() held the lock and then called _ensure_app(), which tried to take the
same non-reentrant Lock again — deadlocking the first Firestore call (and
thus the backend's first request). Use an RLock. Verified end-to-end against
a live Firestore project: source CRUD, save_attempt, leaderboard, and the
manager overview all round-trip, and the server boots + serves.
Also gitignore *firebase-adminsdk*.json so service-account keys never commit.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- app/firebase.py +2 -1
app/firebase.py
CHANGED
|
@@ -20,7 +20,8 @@ from .config import settings
|
|
| 20 |
|
| 21 |
log = logging.getLogger("bima.firebase")
|
| 22 |
|
| 23 |
-
|
|
|
|
| 24 |
_app: Optional[firebase_admin.App] = None
|
| 25 |
_db = None
|
| 26 |
|
|
|
|
| 20 |
|
| 21 |
log = logging.getLogger("bima.firebase")
|
| 22 |
|
| 23 |
+
# Reentrant: fs() holds the lock and calls _ensure_app(), which takes it again.
|
| 24 |
+
_lock = threading.RLock()
|
| 25 |
_app: Optional[firebase_admin.App] = None
|
| 26 |
_db = None
|
| 27 |
|