about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-04-01T19·09+0200
committerEelco Dolstra <edolstra@gmail.com>2019-04-01T19·09+0200
commit2bc6304793e14e44d6d24c1fb35666352c7106f2 (patch)
tree01e7940b593f8a0ffb664511b1345106966d854f /src/libstore
parent2f59b302517dff622743eb081884deacc906b3d1 (diff)
getMachines(): Cache result
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/machines.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libstore/machines.cc b/src/libstore/machines.cc
index edd03d147832..f848582dafd4 100644
--- a/src/libstore/machines.cc
+++ b/src/libstore/machines.cc
@@ -89,10 +89,11 @@ void parseMachines(const std::string & s, Machines & machines)
 
 Machines getMachines()
 {
-    Machines machines;
-
-    parseMachines(settings.builders, machines);
-
+    static auto machines = [&]() {
+        Machines machines;
+        parseMachines(settings.builders, machines);
+        return machines;
+    }();
     return machines;
 }