DiamondLightSource/pythonSoftIOC

Nothing preventing an async on_update function being used when cothread is the dispatcher

Closed this issue · 1 comments

There's currently no ahead-of-time warning/error that passing an async function to on_update/on_update_name is invalid. If you do it, you'll get an error message like this when you update the record:

 /scratch/eyh46967/pipenv/pythonSoftIOC-RPmM1Zwv/lib/python3.7/site-packages/cothread/cothread.py:971: RuntimeWarning: coroutine 'ProcessDeviceSupportOut._complete_update' was never awaited
  action(*args)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/scratch/eyh46967/pipenv/pythonSoftIOC-RPmM1Zwv/lib/python3.7/site-packages/cothread/cothread.py:976: RuntimeWarning: coroutine 'my_sleep' was never awaited
  action = args = None
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

This would not be trivial to check - the dispatcher is only defined during iocInit(), which is after all records have been created and given their callback. So it may not be worth stopping this misconfiguration?

Really don't think this is worth worrying about!