This just seems to be detecting if the browser is Firefox. The function is even named isGecko which is Mozilla's browser engine used by Firefox. Edge, IE (Trident) don't return true from isGecko
Unless I'm missing something I don't see where the delay is added
If you're already using an esp32 why not just get a simple ultrasonic sensor and measure flow on an indoor inlet pipe? You may need to know the pressure (probably 1.7 kPa) and temperature but that should be possible to calibrate against your meter readings
Then your project just becomes a simple pipe clamp that can be indoors