I have an API where i create some publications and broadcast a message for each publication that i created.
The issue is: When i create a publication, that resource will be available for users after one minute, but at this point, message is already broadcasted and user will try to acess it and gets an error.
My doubt: Is that a way to delay this message broadcast, without blocking the request sended to create a publication?
The best approach would be to publish the broadcast when the resource is available, after that one minute. What triggers the resource becoming available? Wherever that codepath is, is where you can hook in the broadcast. If it’s third-party processing, see if they support a post-back URL to your app, which you can then use to broadcast. Make sense?
Your approach it’s the best way to solve the problem, but unfortunately, it’s a third party service that can’t provide me a callback or something like that.
Actually I use the approach that @outlog shared here, but with this kind of solution, whole process still blocking until the sleeps time end.
??? The process which calls Task.start does not block, and I don’t see how the blocking inside of the task could possibly matter, since it’s not visible to anything.