Skip to content

Commit

Permalink
DEBUG/DROPME: Mac, what doing?
Browse files Browse the repository at this point in the history
  • Loading branch information
qstokkink committed Nov 25, 2024
1 parent 3ce7030 commit 5e705a2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 12 additions & 4 deletions ipv8/taskmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,19 @@ async def after_cancel() -> None:
await cast(Awaitable, fut)

done_future.after_cancel_task = after_cancel() # type: ignore[attr-defined]
self.register_anonymous_task(f"[Catch shutdown] {basename}", catch_shutdown)
self.register_anonymous_task(f"[Run shutdown] {basename}",
shield(done_future.after_cancel_task)) # type: ignore[attr-defined]
t1 = self.register_anonymous_task(f"[Catch shutdown] {basename}", catch_shutdown)
t2 = self.register_anonymous_task(f"[Run shutdown] {basename}",
shield(done_future.after_cancel_task)) # type: ignore[attr-defined]

while t1._callbacks is None or len(t1._callbacks) == 0:
await sleep(0) # Enter both infinite loops

while t2._callbacks is None or len(t2._callbacks) < 2:
await sleep(0) # Enter both infinite loops

while done_future._callbacks is None or len(done_future._callbacks) == 0:
await sleep(0) # Enter both infinite loops

await sleep(0) # Enter both infinite loops

return done_future

Expand Down
2 changes: 2 additions & 0 deletions ipv8/test/test_taskmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ async def test_register_shutdown_task(self) -> None:

await self.tm.shutdown_task_manager()

print(fut) # TODO: Mac, what are you doing!?

self.assertTrue(fut.done())
self.assertTrue(sub_fut.cancelled())

Expand Down

0 comments on commit 5e705a2

Please sign in to comment.