Skip to content

Commit aa2c41a

Browse files
committed
improve(mcl.commands.ci_matrix): Factor-out and parallelize cache status checks
1 parent cc52333 commit aa2c41a

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

packages/mcl/src/src/mcl/commands/ci_matrix.d

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,33 @@ export void ci_matrix()
150150
nixEvalForAllSystems().array.printTableForCacheStatus();
151151
}
152152

153+
Package[] checkCacheStatus(Package[] packages)
154+
{
155+
import std.array : appender;
156+
import std.parallelism : parallel;
157+
158+
foreach (ref pkg; packages.parallel)
159+
{
160+
pkg = checkPackage(pkg);
161+
struct Output { string isCached, name, storePath; }
162+
auto res = appender!string;
163+
writeRecordAsTable(
164+
Output(pkg.isCached ? "" : "", pkg.name, pkg.output),
165+
res
166+
);
167+
tracef("%s", res.data[0..$-1]);
168+
}
169+
return packages;
170+
}
171+
153172
export void print_table()
154173
{
155174
params = parseEnv!Params;
156-
157175
createResultDirs();
158-
Package[] precalcMatrix = getPrecalcMatrix();
159-
auto checkedPackages = precalcMatrix.map!(checkPackage).array;
160-
printTableForCacheStatus(checkedPackages);
176+
177+
getPrecalcMatrix()
178+
.checkCacheStatus()
179+
.printTableForCacheStatus();
161180
}
162181

163182
struct Params

0 commit comments

Comments
 (0)