This topic was automatically generated from Slack. You can find the original thread here.
Nacho Caballero : What’s the best practice for delaying a call to $emit from a source?
I’m currently responding instantly to the Zoom meeting.ended event, but there are a few things I’d like to do 20 minutes after a meeting. Should I use a timeout or would that be ignored?
I guess another option would be to create a new-scheduled-tasks source and use axios to send a request with timestamp + 20 minutes from my existing meeting-ended source.
Dylan Sather (Pipedream) : in your case you should be able to use the feature behind the task scheduler in this case. Just set delivery_ts to be 20 min later:
this.$emit(event, {
delivery_ts: 123456789 // epoch ms
}
In this case you’ll see the event emitted immediately in your list of events in the UI, but listening workflows will be triggered after the specified delay. If you add listeners after you’ve emitted an event with a delivery_ts, those workflows won’t receive the event - you need to make sure the workflow is linked, then make your future emits.
This is still considered an “alpha” feature, and Giao and I were discussing some changes to this API yesterday based on your feedback on the task scheduler. But give it a try and see if that works for you
Dylan Sather (Pipedream) : yes wherever you’d like to implement the delayed emit. In your case if you wanted to do work immediately after the meeting and 20 min after the meeting, you can just call this.$emit() twice in that source - once normally, and once with the delivery_ts 20 min in the future