Do not run self.communicate() on every iteration

We count consecutive iterations that do not have any output, and
only if it reaches a certain threshold, self.communicate() is run.