There are two channels. This is not my design and I have to implement it.
You cannot send the late reply to the from of the initial call. It is a phoenix controller, after 2500ms it replies to the http request and then it’s gone. That is why there is another channel to send the late reply.
From your description you seem to be pushing the “late” value via a Phoenix channel.
Meanwhile you are potentially delaying the response inside the controller for up to 2.5 seconds for the result to possibly show up.
2.5 seconds is valuable time wasted in terms of UX - i.e. minimizing time to first meaningful paint.
Given that (1.) is already in place, wouldn’t it make more sense to immediately render the page with the “pending” placeholder from the controller and update it in the browser it as soon as the value is pushed via the Phoenix channel?
Well as you want details, there is no phoenix channel, the other way is to post the response to another website via HTTP.
I am implementing a Slack command that will do some stuff on the Gitlab API. Heavy stuff, so it can take a while, but sometimes it will take half a second to work. This is for other devs and they do not really care about the first meaningful paint
Indeed, as I am coding it, I am leaning towards always acknowledging first and always sending the reply through the other way. It is not what is asked though, but it seems that the Slack timeout is too sensitive about network latency.