harvimt / quamash

Implementation of the PEP 3156 event-loop (asyncio) api using the Qt Event-Loop
BSD 2-Clause "Simplified" License
264 stars 46 forks source link

[Bug or Feature Requests] aioredis connect raise 'Event callback failed' #120

Open 625781186 opened 5 years ago

625781186 commented 5 years ago

env: python 3.6.4 64bit pyqt5 5.10.1 aioredis 1.1.0 ~1.3.0 quamash 0.6.1

error:

image

use asyncio loop is ok:

image

##testcode.py
from PyQt5.QtWidgets import QApplication, QProgressBar
from quamash import QEventLoop, QThreadExecutor

app = QApplication(sys.argv)
loop = QEventLoop(app)
asyncio.set_event_loop(loop)  # NEW must set the event loop

progress = QProgressBar()
progress.setRange(0, 99)
progress.show()

async def master():
    await first_50()

async def first_50():
    red_sql = await aioredis.create_redis_pool(f"redis://localhost:6379/1")

with loop: ## context manager calls .close() when loop completes, and releases all resources
    loop.run_until_complete(master())