As long as the queen is alive, the number of Zergs wouldn't lessen but would instead continue to grow.
Zergs continue attacking them because of the resources in their galaxy. After years of study, the Federation understood that the Zergs kept attacking them because they needed resources.
The galaxy they are currently in has abundant resources which is why it was always attacked by the Zergs.
The surrounding galaxies were also being attacked by Zergs, but they currently don't have any energy to reach out for communication.
They knew that there were also lifeforms in different galaxies, but they hadn't reached out to them, so the federation also didn't bother to care about them as they were still busy with the Zergs invasion.
Humans already have a hard time dealing with the Zergs, so they didn't want to add more enemies to themselves if it turns out that those lifeforms in other galaxies were also a threat like the Zergs.