Skip to content

Commit 88c0c70

Browse files
committed
Add connection info to multithreaded_processor parameters
This removes the weird way we get to the connection info through the output.
1 parent ae7fb4d commit 88c0c70

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/osmdata.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,13 @@ class multithreaded_processor
174174
public:
175175
using output_vec_t = std::vector<std::shared_ptr<output_t>>;
176176

177-
multithreaded_processor(std::shared_ptr<middle_t> const &mid,
177+
multithreaded_processor(std::string const &conninfo,
178+
std::shared_ptr<middle_t> const &mid,
178179
output_vec_t outs, size_t thread_count)
179180
: m_outputs(std::move(outs))
180181
{
181182
assert(!m_outputs.empty());
182183

183-
// The database connection info should be the same for all outputs,
184-
// we take it arbitrarily from the first.
185-
std::string const &conninfo =
186-
m_outputs[0]->get_options()->database_options.conninfo();
187-
188184
// For each thread we create clones of all the outputs.
189185
m_clones.resize(thread_count);
190186
for (size_t i = 0; i < thread_count; ++i) {
@@ -387,11 +383,12 @@ void osmdata_t::stop() const
387383
// In append mode there might be dependent objects pending that we
388384
// need to process.
389385
if (opts->append && m_dependency_manager->has_pending()) {
390-
multithreaded_processor proc{m_mid, m_outs,
391-
(std::size_t)opts->num_procs};
386+
multithreaded_processor proc{opts->database_options.conninfo(), m_mid,
387+
m_outs, (std::size_t)opts->num_procs};
392388

393389
proc.process_ways(m_dependency_manager->get_pending_way_ids());
394-
proc.process_relations(m_dependency_manager->get_pending_relation_ids());
390+
proc.process_relations(
391+
m_dependency_manager->get_pending_relation_ids());
395392
proc.merge_expire_trees();
396393
}
397394

0 commit comments

Comments
 (0)