opal icon indicating copy to clipboard operation
opal copied to clipboard

Data source refresh

Open DServy opened this issue 1 year ago • 2 comments

exposes periodic_update_interval on OPAL_DATA_SOURCE_CONFIG to allow for auto PUT data updates from a given source to be generated at a set interval (in seconds)

DServy avatar Oct 04 '22 21:10 DServy

Deploy Preview for opal-docs canceled.

Name Link
Latest commit 974b704f8a5d21ffab132bb9bac27e99b706feae
Latest deploy log https://app.netlify.com/sites/opal-docs/deploys/6349aba45a285c00089878b7

netlify[bot] avatar Oct 04 '22 21:10 netlify[bot]

@orweis I've updated it with your feedback besides the locally defined named function. Mainly since it seemed to not like doing it with list comprehension, and I didn't want to do it outside the list comprehension because I thought it would break function scope on that (because I have a very limited understanding of how python does scoping)

DServy avatar Oct 05 '22 14:10 DServy

It's not working when you have multiple entries. It "register" multiple entries but then trigger x times the last entry. The issue is in packages/opal-server/opal_server/data/data_update_publisher.py line 139. bind_for_repeat() is using the local variable source of the function create_polling_update() and not it's own. That's why at the end, retry will always trigger only the last entry. I am checking and will push a fix tomorrow (github is blocked at my company)

loan75 avatar Oct 26 '22 10:10 loan75

@asafc @orishavit

orweis avatar Oct 26 '22 10:10 orweis

Just with that it should fix it i think (Maybe i am wrong, i am new in the coroutines world):

async def bind_for_repeat(bind_source = source): await self._periodic_update_callback(bind_source)

loan75 avatar Oct 26 '22 15:10 loan75