Below’s how my soil moisture sensor looks after 6 days continuously operating, quite corroded. I now switched to the method @Sam Freriks suggested here. I guess that it makes sense to use a digital pin (D1) to switch on the current/voltage to the sensor only while taking a measurement. Every 5 minutes or even longer intervals should be totally fine.
/reply from Sam Freriks
Woah corrosion goes fast! The method should slow it down quite a bit nice idea to put a heat shrink around the connector btw!