diff options
-rw-r--r-- | bdep/build.txx | 14 | ||||
-rw-r--r-- | bdep/ci.cxx | 5 | ||||
-rw-r--r-- | bdep/deinit.cxx | 18 | ||||
-rw-r--r-- | bdep/fetch.cxx | 14 | ||||
-rw-r--r-- | bdep/publish.cxx | 5 |
5 files changed, 38 insertions, 18 deletions
diff --git a/bdep/build.txx b/bdep/build.txx index 1cd5fff..b83aa9c 100644 --- a/bdep/build.txx +++ b/bdep/build.txx @@ -45,11 +45,17 @@ namespace bdep const dir_path& prj (pp.project); - database db (open (prj, trace)); + // Load the configurations without keeping the database open longer + // than necessary. + // + configurations cfgs; + { + database db (open (prj, trace)); - transaction t (db.begin ()); - configurations cfgs (find_configurations (o, prj, t)); - t.commit (); + transaction t (db.begin ()); + cfgs = find_configurations (o, prj, t); + t.commit (); + } // If specified, verify packages are present in each configuration. // diff --git a/bdep/ci.cxx b/bdep/ci.cxx index 08f2578..81db678 100644 --- a/bdep/ci.cxx +++ b/bdep/ci.cxx @@ -200,10 +200,13 @@ namespace bdep false /* load_packages */)); const dir_path& prj (pp.project); - database db (open (prj, trace)); shared_ptr<configuration> cfg; { + // Don't keep the database open longer than necessary. + // + database db (open (prj, trace)); + transaction t (db.begin ()); configurations cfgs (find_configurations (o, prj, t)); t.commit (); diff --git a/bdep/deinit.cxx b/bdep/deinit.cxx index 735b746..18acf52 100644 --- a/bdep/deinit.cxx +++ b/bdep/deinit.cxx @@ -111,14 +111,16 @@ namespace bdep database db (open (prj, trace)); - transaction t (db.begin ()); - configurations cfgs ( - find_configurations (o, - prj, - t, - true /* fallback_default */, - !force /* validate */)); - t.commit (); + configurations cfgs; + { + transaction t (db.begin ()); + cfgs = find_configurations (o, + prj, + t, + true /* fallback_default */, + !force /* validate */); + t.commit (); + } // If specified, verify packages are present in each configuration. // diff --git a/bdep/fetch.cxx b/bdep/fetch.cxx index 7a88106..3527e51 100644 --- a/bdep/fetch.cxx +++ b/bdep/fetch.cxx @@ -33,11 +33,17 @@ namespace bdep tracer trace ("fetch"); dir_path prj (find_project (o)); - database db (open (prj, trace)); - transaction t (db.begin ()); - configurations cfgs (find_configurations (o, prj, t)); - t.commit (); + configurations cfgs; + { + // Don't keep the database open longer than necessary. + // + database db (open (prj, trace)); + + transaction t (db.begin ()); + cfgs = find_configurations (o, prj, t); + t.commit (); + } bool first (true); for (const shared_ptr<configuration>& c: cfgs) diff --git a/bdep/publish.cxx b/bdep/publish.cxx index 1fcc942..ab58025 100644 --- a/bdep/publish.cxx +++ b/bdep/publish.cxx @@ -807,12 +807,15 @@ namespace bdep true /* load_packages */)); const dir_path& prj (pp.project); - database db (open (prj, trace)); // We need a single configuration to prepare package distribution. // shared_ptr<configuration> cfg; { + // Don't keep the database open longer than necessary. + // + database db (open (prj, trace)); + transaction t (db.begin ()); configurations cfgs (find_configurations (o, prj, t)); t.commit (); |