Skip to content

Commit

Permalink
Skip processing stage entirely when no objects are pending
Browse files Browse the repository at this point in the history
The processing stage opens quite a few connections to the
database. This can be avoided when no objects are pending.

Improves on osm2pgsql-dev#885.
  • Loading branch information
lonvia authored and tomhughes committed Feb 12, 2020
1 parent 5c3327e commit 34e65be
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion osmdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,13 @@ void osmdata_t::stop() {
// should be the same for all outputs
auto *opts = outs[0]->get_options();

{
// are there any objects left pending?
bool has_pending = mid->pending_count() > 0;
for (auto const &out : outs) {
has_pending |= out->pending_count() > 0;
}

if (has_pending) {
//threaded pending processing
pending_threaded_processor ptp(mid, outs, opts->num_procs,
opts->append);
Expand Down

0 comments on commit 34e65be

Please sign in to comment.