More streamlined interface with Pillar.

Using a semaphore to ensure requests to Pillar aren't too parallel,
so that we can cancel requests faster.
This commit is contained in:
2016-04-01 18:47:06 +02:00
parent 2c4c102302
commit 29230f09e7
3 changed files with 42 additions and 46 deletions

View File

@@ -4,6 +4,7 @@ import asyncio
import traceback
import concurrent.futures
import logging
import gc
import bpy
@@ -53,6 +54,9 @@ def kick_async_loop(*args) -> bool:
len(all_tasks))
stop_after_this_kick = True
# Clean up circular references between tasks.
gc.collect()
for task_idx, task in enumerate(all_tasks):
if not task.done():
continue
@@ -68,6 +72,9 @@ def kick_async_loop(*args) -> bool:
print('{}: resulted in exception'.format(task))
traceback.print_exc()
# for ref in gc.get_referrers(task):
# log.debug(' - referred by %s', ref)
loop.stop()
loop.run_forever()