Skip to content

Commit b7900e9

Browse files
Fix scheduler start event detection (#136)
1 parent ddb6bcd commit b7900e9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/dipdup/dipdup.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ async def run(
7474
spawn_datasources_event.set()
7575

7676
if start_scheduler_event and not start_scheduler_event.is_set():
77-
if self._every_index_is(IndexStatus.REALTIME):
77+
# NOTE: Do not check with every_index_is, indexes become REALTIME after first message from WS is received
78+
for index in self._indexes.values():
79+
if index.state.level != index.datasource.head.level:
80+
break
81+
else:
7882
start_scheduler_event.set()
7983

8084
def stop(self) -> None:
@@ -215,6 +219,7 @@ async def run(self, reindex: bool, oneshot: bool) -> None:
215219
await self._set_up_hasura(stack, tasks)
216220

217221
spawn_datasources_event: Optional[Event] = None
222+
start_scheduler_event: Optional[Event] = None
218223
if not oneshot:
219224
start_scheduler_event = await self._set_up_scheduler(stack, tasks)
220225
spawn_datasources_event = await self._spawn_datasources(tasks)

0 commit comments

Comments
 (0)