Greetings, me again with the (probably) annoying questions.
I’ve got a function I’d like to delay in order for eventual additional user input and I’m not sure how to approach this.
Let me elaborate with an example.
I’ve got a table with 3 editable columns (A, B, C) and a hidden column that fires a webhook on field changes. I’d like to delay triggering the webhook by some time (let’s say 30 seconds) to allow additional changes by the user.
Is this possible?
I’m running self hosted, willing to add additional pip packages if they can help somehow.
Wasn’t sure which section of the forum was suitable for the thread, sorry if I’ve got it wrong.
Hmm I can’t think of an easy way to do this. In self hosted, you could modify the following variable so that formulas that check the time are updated more often, and then you could write a suitable formula to check when the last edit was made:
If formulas were to sleep with Python’s native
time.sleep method, that would lock the data engine and performance would be bad. With some programming work, it might be possible to create a way to sleep without locking. There is an experimental and unadvertised
REQUEST(url) function that can be enabled by setting
GRIST_EXPERIMENTAL_PLUGINS=1, and the way it is implemented might work for a new
SLEEP(delay) function that doesn’t lock the data engine.
Hope someone else can think of a simpler solution
Thank you for the reply!
I already have delayed the execution of the formula itself actually, just using an asyncio timer and asyncio.run() so I wouldn’t lock the backend.
The problem now is this would queue multiple executions with each change within the time span, so it would call the webhook every time, which is basically what I’m trying to avoid lol
Edit: don’t want to bump the thread with a new reply, thus why editing.
I haven’t needed it before, but is it possible to edit another column’s value?
If that’s possible I could just have a pseudo cooldown column that locks the call to the webhook for a period.
For anyone that might stumble on this - I ended up using n8n, having an urllib call trigger a workflow that has a wait, then rest is done via the Grist API.