Ah, the dreaded vinegar fly eh!
In all the years of brewing at about 1 brew per week for 48 weeks of the year over 8 years, (yes 8),I never got it.
That's by good brewing practice, good beer management, no airlock on primary fermenter and long secondary rests.
I dont say airlocks are not good...