I had a pretty bad root rot/gnat infestation a few months back. Plants were yellowing, wilting and dying. As a budget grower I was limited in my options but I managed to not only stop them, but almost eliminate them all overnight.
I got my hands on some 30% H2O2 and mixed it 1:30 with in a 7L watering pail and then something called Gnatnix which is if I'm not mistaken just ground sea shells that are very sharp and slice up larvae as they emerge from the surface of your growing medium and I put about a 1'' layer of it on the topsoil of my 8 plants then watered with my 1% H202 solution. Also I sprayed 3% H2O2 on the exposed roots of the plant.
The next day the plants were perking back up and there were way less adults flying around. The day after that there were next to none until it was all gone.
It saved my crop tbh because 90% of the leaves were bright bright yellow but next day the color was coming back and they all got their color back.
My pythium/root rot came from over watering and improper drainage so I've at least learned half of that lesson but am still struggling to get adequate drainage in my medium. I also recommend always having some sort of sticky trap or fly tape in your room to serve as early detection, although they are not going to solve your problem, at least you'll know for sure they are there.
Hope this helps any of those struggling to fight these things on a budget, total cost was about $35CAD.