I think it should be possible to get an expect refresh time of the device from SSDP.
We should be able to listen for device announcements and goodbyes, not just rely on repeating the search
Is the search expiring after 4 seconds? Perhaps some devices don't respond in this time. Try to work out why discovery is imperfect. Perhaps issue searches rapidly at the start, if that's the best we can do, then slow down after 5 or so.
Various things:
[Resource explaining the protocol](https://sethlopez.me/article/writing-a-upnp-control-point-in-javascript-part-two/
Possibly there are better SSDP modules, or perhaps add ability to listen to annoucements/goodbyes to the existing module.