Skip to content

Commit bb00076

Browse files
committed
Skip processing stage entirely when no objects are pending
The processing stage opens quite a few connections to the database. This can be avoided when no objects are pending. Improves on #885.
1 parent 821775e commit bb00076

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

osmdata.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,13 @@ void osmdata_t::stop() {
422422
// should be the same for all outputs
423423
auto *opts = outs[0]->get_options();
424424

425-
{
425+
// are there any objects left pending?
426+
bool has_pending = mid->pending_count() > 0;
427+
for (auto const &out : outs) {
428+
has_pending |= out->pending_count() > 0;
429+
}
430+
431+
if (has_pending) {
426432
//threaded pending processing
427433
pending_threaded_processor ptp(mid, outs, opts->num_procs,
428434
opts->append);

0 commit comments

Comments
 (0)