Changeset - 63f82ec045bf
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 20 months ago 2023-05-31 22:25:26
drewp@bigasterisk.com
don't stop midi input on a handler error
1 file changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
light9/midifade/midifade.py
Show inline comments
 
@@ -4,6 +4,7 @@ Read midi events, write fade levels to g
 
"""
 
import asyncio
 
import logging
 
import traceback
 

	
 
import mido
 
from rdfdb.syncedgraph.syncedgraph import SyncedGraph
 
@@ -57,8 +58,11 @@ async def main():
 
            recents = [await msgs.get()]
 
            while not msgs.empty():
 
                recents.append(msgs.get_nowait())
 

	
 
            try:
 
            onMessage(graph, ctx, recents[-1])
 
            except Exception as e:
 
                traceback.print_exc()
 
                log.warning("error in onMessage- continuing anyway")
 
            await asyncio.sleep(1 / MAX_SEND_RATE)
 

	
 
    asyncio.create_task(reader())
0 comments (0 inline, 0 general)