Backend workflow every 10 seconds

Hi id like to create backend workflow that will start every 10 secends.

  1. User Click button to generate video
  2. then in the backend GET api CHECKS EVERY 10 SECONDS OR 30 SCONDS if the video is ready
  3. When the video is ready, aplication send to user an email that his video is ready and it is wating on the website.
  4. If video is COMPLETED workflow stop for this user
  5. if we get error message from API - VIDEO FAIL, then we send user email that it fails and we stop workflow.

can any wone advise me how to setup sucha thing?

Just run a recursive workflow every ten seconds until the video is ready…

Which aspect are you having trouble with?

well how to setup in the backend. so when user close the browser. Sorry im kind of newbiee:)

there is dail recuring event

Start with this:

ok thanks and how to stop it when work is done?

don’t schedule it again by using a condition that only runs when the work isn’t done (i.e when result of API request is video isn’t ready or error)

You’re going to destroy your WU usage especially if you make a mistake and something creates and endless loop.

Idk what API you’re hitting but Most APIs have ways to avoid this. Usually webhooks or callbacks.

Idk what your app is or UX is but there surely is a UX flow you can implement that

There is typically something to avoid such bad practice.


well iv set something like this :slight_smile:

and it doesnt creat a backend shedule :frowning:

That’s not a recursive workflow…

1 Like

ok it is difficult \

Yeah sometimes polling is just unavoidable… a bit of a pain in the ass. The last time I saw it was an Adobe PDF API.

Did you read the manual link @adamhholmes sent in detail? It gives step by step instructions which are more detailed than anyone will write here.

Yeah… the manual explains it in more detail than anyone will in here…

But really, it’s not difficult at all:

Create a workflow and add some actions (one of which is to schedule the workflow to run again in 10 seconds time).

got something like this

  1. one the page

  2. second backend worklflow

and on sheduler got this

so no shedule

Well you scheduled it once, but that’s it. The workflow you scheduled needs to schedule itself as the last action. Read the manual in detail and it’s impossible to go wrong (well, so long as you add a condition that stops it running infinitely)…

well have any one got a video :slight_smile: sorry but i dont understand where is my mistake

i have only one video:) and need to check if the APi REPLY with url . If yes i need to send email to user and that is it

Create 2 backend workflows
First: 1-video-check
Second: 2-video-check-success

On front end when you click to initiate the scheduled flow you schedule a single backend workflow for 1-video-check for current date and time.

1-video-check workflow looks like this with 3 steps.

Lip sync-get movie api call >

schedule api workflow (1-video-check, current time+10 seconds) (only if success = no) >

schedule api workflow (2-video-check-success, current date time, only if success = yes)

Then your 2-video-check-success workflow will include you make changes to a thing & email, etc.

Logic here is that 2nd step of 1-video-check will endlessly loop the same check workflow until a success=yes, then it proceeds.

— ^^^this gets what you want^^^—

Personally I’d recommend putting a ”pollStartTime” field as a date on the original record that gets passed to 1-video-check.

Then have a conditional on that workflow where if “pollStartTime” is more than 10 min ago it won’t run. This is to stop an endless loop from occurring. Max it’ll happen is 10min which is still a lot but better than unlimited.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.