Rest sensors and rest switches: scan_interval and timeout settings

Rest sensors and rest switches:
what is the relationship between SCAN_INTERVAL and TIMEOUT settings?

I mean, suppose I have a rest sensor configured for:
scan_interval: 5 secs
timeout: 20 secs
What happens if the source sometimes doesn’t answer within 5 secs but requires a longer time?

Does HA send again a new request after 5 secs (at every scan_interval) even if no answer has been yet received, or will HA pause until the timeout has expired or the answer has been received (whichever comes first)?

From my findings it appears that HA doesn’t wait for timeout expiration and fills the log with this message:
“Updating rest sensor took longer than the scheduled update interval 0:00:05”

Shouldn’t HA respect the timeout setting?