I know it's a clickbait title, but this is a serious question. Recently, in Sri Lanka, the government deployed https://fuelpass.gov.lk/ application where a Sri Lankan can register and check the fuel available for the registered vehicle. (The system was designed to control the amount of fuel available to an individual as fuel imports have slowed down due to the economic crisis).
When I checked the system yesterday I realized that they have deployed the dev build to production. As I was going through the code, I noticed that in the Login component, there is a setTimeout call on the form submit to show a loading animation.
The login component looked something like this:
export default () => {
const [waiting, setWaiting] = useState(false)
return(
<Loading showLoading = {waiting}>
<form onSubmit = {() => {
setWaiting(true)
setTimeout(async () => {
await loginRequestCall()
setWaiting(false)
}, Math.floor(Math.random() * 5000)
}}>
<input />
<button>Send OTP</button>
</form>
</Loading>
)
}
Screenshot of the source code:

The important part is, when user clicks on the Send OTP, It shows the loading screen, only after waiting a random amount of time it sends the request.
I created a video about this and it kinda went viral in Sri Lanka. According to the comments, some of the justifications (for using setTimeout with a random amount of time to wait) were following.
I wouldn't think if someone wanted to DDos they would be dumb enough to use UI automation. There is no need of setTimeout to prevent spam also.
Which leave me with the last point.
So my questions are,
setTimeout?setTimout?Is it possible to load balance using setTimeout?
Load balancing is the process of distributing network traffic across multiple servers.
Since load balancing is not reducing the number of calls but distributing them, it is not possible to do load balancing using setTimeout
If so, how exactly would it distribute the load?
As I mentioned, it is impossible to do so with setTimeout, at least not in a non-hacky and inefficient manner.
Is there a valid reason to add a setTimout?
In my opinion, this setTimeout might be intended to be used as a debounce function to avoid the user clicking on the OTP button multiple times if the feedback is not provided immediately (but still not doing the work since all calls will be done anyway).
So the answer is NO, in my opinion, there is not any valid reason for this setTimeout