HOW TO: How can I add a delay between an import and a lookup?
When creating an object via an API as part of an import, it is possible that you might encounter some race conditions where the import returns successfully, but the new object is not fully written yet to the application by the time integrator.io queries it in the lookup. The lookup could then fail with the error “Object not found.”
To work around this issue, you can insert a delay before the lookup by adding a dummy lookup flow step before it. This dummy could just look up something harmless and not impact the results, or you can look up something that would never have results.
To test whether the record is available via the lookup, you could try first doing an initial lookup in the postSubmit function of the import (using our API via JS) to see if this makes the problem worse. The postSubmit runs immediately after the import runs, while the lookup likely runs 15 seconds later. In case the script fails, you could keep the dummy lookup flow step in place as a secondary fallback (with a filter to ignore objects where the script worked). The script could run the lookup a couple of times and also return debug information to help you troubleshoot.
We do not recommend adding a JS loop because we already have timeouts and instruction count limits in our JS runtime, so this will likely not be helpful and will also slow down your flow.
This works okay... but feels a little bit like a hacky workaround. And sometimes it's not knowable how long a given lookup will take, and therefore whether that would be sufficient for the race condition to resolve.
Would be it possible to get a simple delay block to insert into flows to help control for race conditions or for database replications to complete in external systems?1
Hi Jeff Dollard,
Thanks for this feedback and insight! Would you mind adding your enhancement request to our community? That will enable others to comment on it and upvote it. Thank you!0
Sure thing Courtney - I've added it to the enhancement requests board. Thanks!0
Please sign in to leave a comment.