mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 01:26:15 +02:00
* Performance improvement: don't register already registered terms,
thus greatly reducing the number of db transactions.
This commit is contained in:
parent
08b7319f5b
commit
1eb4da156c
1 changed files with 8 additions and 5 deletions
|
@ -37,12 +37,15 @@ Path writeTerm(ATerm t, const string & suffix)
|
||||||
|
|
||||||
Path path = canonPath(nixStore + "/" +
|
Path path = canonPath(nixStore + "/" +
|
||||||
(string) h + suffix + ".nix");
|
(string) h + suffix + ".nix");
|
||||||
|
|
||||||
|
if (!isValidPath(path)) {
|
||||||
if (!ATwriteToNamedTextFile(t, path.c_str()))
|
if (!ATwriteToNamedTextFile(t, path.c_str()))
|
||||||
throw Error(format("cannot write aterm %1%") % path);
|
throw Error(format("cannot write aterm %1%") % path);
|
||||||
|
|
||||||
Transaction txn(nixDB);
|
Transaction txn(nixDB);
|
||||||
registerValidPath(txn, path);
|
registerValidPath(txn, path);
|
||||||
txn.commit();
|
txn.commit();
|
||||||
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue