Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
droserasprout committed Nov 25, 2023
1 parent 521804b commit a8a6355
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/dipdup/index.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from abc import ABC
from abc import abstractmethod
from collections import deque
from contextlib import ExitStack
from typing import Any
from typing import Generic
from typing import TypeVar
Expand Down Expand Up @@ -133,8 +132,7 @@ async def process(self) -> bool:

last_level = self._config.last_level
if last_level:
with ExitStack() as stack:
stack.enter_context(Metrics.measure_total_sync_duration())
with Metrics.measure_total_sync_duration():
await self._synchronize(last_level)
await self._enter_disabled_state(last_level)
return True
Expand All @@ -146,14 +144,12 @@ async def process(self) -> bool:
self._logger.info('Index is behind the datasource level, syncing: %s -> %s', index_level, sync_level)
self._queue.clear()

with ExitStack() as stack:
stack.enter_context(Metrics.measure_total_sync_duration())
with Metrics.measure_total_sync_duration():
await self._synchronize(sync_level)
return True

if self._queue:
with ExitStack() as stack:
stack.enter_context(Metrics.measure_total_realtime_duration())
with Metrics.measure_total_realtime_duration():
await self._process_queue()
return True

Expand Down

0 comments on commit a8a6355

Please sign in to comment.