- break
-
- LOG.debug("Processing places: %s", str(places))
- worker = pool.next_free_worker()
-
- runner.index_places(worker, places)
- progress.add(len(places))
+ t0 = time.time()
+ fetcher.wait()
+ fetcher_wait += time.time() - t0
+ places = fetcher.cursor.fetchall()
+
+ # asynchronously get the next batch
+ next_places = self._fetch_next_batch(cur, fetcher, runner)
+
+ # And insert the curent batch
+ for idx in range(0, len(places), batch):
+ t0 = time.time()
+ worker = pool.next_free_worker()
+ pool_wait += time.time() - t0
+ part = places[idx:idx+batch]
+ LOG.debug("Processing places: %s", str(part))
+ runner.index_places(worker, part)
+ progress.add(len(part))
+
+ places = next_places