fix(incidents): batch decision token lookup
This commit is contained in:
@@ -30,8 +30,15 @@ class _IncidentService:
|
||||
class _DecisionManager:
|
||||
def __init__(self) -> None:
|
||||
self.created = 0
|
||||
self.single_token_lookups = 0
|
||||
self.batch_token_lookups = 0
|
||||
|
||||
async def _find_existing_tokens_for_incidents(self, incident_ids: list[str]):
|
||||
self.batch_token_lookups += 1
|
||||
return {}
|
||||
|
||||
async def _find_existing_token(self, incident_id: str):
|
||||
self.single_token_lookups += 1
|
||||
return None
|
||||
|
||||
async def get_or_create_decision(self, *args, **kwargs):
|
||||
@@ -51,3 +58,5 @@ async def test_list_incidents_does_not_trigger_ai_decision_by_default(monkeypatc
|
||||
assert result.incidents[0].incident_id == "INC-20260506-PURE01"
|
||||
assert result.incidents[0].decision is None
|
||||
assert decision_manager.created == 0
|
||||
assert decision_manager.batch_token_lookups == 1
|
||||
assert decision_manager.single_token_lookups == 0
|
||||
|
||||
Reference in New Issue
Block a user