Skip to content

Commit 9d1075b

Browse files
Only propagate live contract count to metric (#4934)
The shared module cache compiler was accidentally counting dead contracts as well as live ones in the metric that tracks the number of contracts in the cache. This fixes that issue.
2 parents d8c08c9 + bc1211d commit 9d1075b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ledger/SharedModuleCacheCompiler.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ SharedModuleCacheCompiler::start()
145145
mThreads.emplace_back(std::thread([this]() {
146146
ZoneScopedN("load wasm contracts");
147147
std::unordered_set<Hash> seenContracts;
148+
size_t liveContracts{0};
148149
this->mSnap->scanForEntriesOfType(
149150
CONTRACT_CODE, [&](BucketEntry const& entry) {
150151
Hash h;
@@ -155,6 +156,7 @@ SharedModuleCacheCompiler::start()
155156
h = entry.liveEntry().data.contractCode().hash;
156157
if (seenContracts.find(h) == seenContracts.end())
157158
{
159+
++liveContracts;
158160
this->pushWasm(
159161
entry.liveEntry().data.contractCode().code);
160162
}
@@ -168,7 +170,7 @@ SharedModuleCacheCompiler::start()
168170
seenContracts.insert(h);
169171
return Loop::INCOMPLETE;
170172
});
171-
this->setFinishedLoading(seenContracts.size());
173+
this->setFinishedLoading(liveContracts);
172174
}));
173175

174176
for (auto thread = 1; thread < this->mNumThreads; ++thread)

0 commit comments

Comments
 (0)