fix(incidents): bind durable readback tenant context
This commit is contained in:
@@ -730,9 +730,17 @@ class IncidentService:
|
||||
)
|
||||
return "updated"
|
||||
|
||||
async def get_for_readback(self, incident_id: str) -> Incident | None:
|
||||
async def get_for_readback(
|
||||
self,
|
||||
incident_id: str,
|
||||
*,
|
||||
project_id: str | None = None,
|
||||
) -> Incident | None:
|
||||
"""Return durable incident truth, with Redis as an availability fallback."""
|
||||
incident = await self.get_from_episodic_memory(incident_id)
|
||||
incident = await self.get_from_episodic_memory(
|
||||
incident_id,
|
||||
project_id=project_id,
|
||||
)
|
||||
if incident is not None:
|
||||
return incident
|
||||
|
||||
@@ -742,7 +750,11 @@ class IncidentService:
|
||||
)
|
||||
return await self.get_from_working_memory(incident_id)
|
||||
|
||||
async def get_active_incidents(self) -> list[Incident]:
|
||||
async def get_active_incidents(
|
||||
self,
|
||||
*,
|
||||
project_id: str | None = None,
|
||||
) -> list[Incident]:
|
||||
"""
|
||||
列出所有活躍的 Incidents。
|
||||
|
||||
@@ -755,7 +767,9 @@ class IncidentService:
|
||||
try:
|
||||
from src.repositories.incident_repository import get_incident_repository
|
||||
|
||||
incidents = await get_incident_repository().get_active()
|
||||
incidents = await get_incident_repository().get_active(
|
||||
project_id=project_id,
|
||||
)
|
||||
logger.info(
|
||||
"get_active_incidents_from_episodic_memory",
|
||||
count=len(incidents),
|
||||
|
||||
Reference in New Issue
Block a user