Skip to content

Commit

Permalink
refactor: process annotations after spans
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerHYang committed Jul 30, 2024
1 parent 849fa8b commit 6149f42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/phoenix/db/bulk_inserter.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@ async def _bulk_insert(self) -> None:
or self._spans
or self._evaluations
):
if not self._queue_inserters.empty:
if inserted_ids := await self._queue_inserters.insert():
for project_rowid in await self._get_project_rowids(inserted_ids):
self._last_updated_at_by_project[project_rowid] = datetime.now(timezone.utc)
if self._operations.empty() and not (self._spans or self._evaluations):
await asyncio.sleep(self._sleep)
continue
Expand Down Expand Up @@ -200,6 +196,10 @@ async def _bulk_insert(self) -> None:
evaluations_buffer = None
for project_rowid in transaction_result.updated_project_rowids:
self._last_updated_at_by_project[project_rowid] = datetime.now(timezone.utc)
if not self._queue_inserters.empty:
if inserted_ids := await self._queue_inserters.insert():
for project_rowid in await self._get_project_rowids(inserted_ids):
self._last_updated_at_by_project[project_rowid] = datetime.now(timezone.utc)
await asyncio.sleep(self._sleep)

async def _insert_spans(self, spans: List[Tuple[Span, str]]) -> TransactionResult:
Expand Down
4 changes: 2 additions & 2 deletions src/phoenix/db/insertion/constants.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
DEFAULT_RETRY_DELAY_SEC: float = 60
DEFAULT_RETRY_ALLOWANCE: int = 10
DEFAULT_RETRY_DELAY_SEC: float = 10
DEFAULT_RETRY_ALLOWANCE: int = 60

0 comments on commit 6149f42

Please sign in to comment.