Skip to content

Commit 4729153

Browse files
authored
Fix logging for older runtimes for runtimeapi decoration (#5988)
1 parent a15d0dd commit 4729153

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

packages/api/src/base/Decorate.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -544,8 +544,8 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
544544

545545
this.#runtimeLog[implName] = true;
546546

547-
for (let i = 0, scount = sections.length; i < scount; i++) {
548-
if (isApiInMetadata) {
547+
if (isApiInMetadata) {
548+
for (let i = 0, scount = sections.length; i < scount; i++) {
549549
const [_section, secs] = sections[i];
550550
const sec = secs[0];
551551
const sectionHash = blake2AsHex(_section, 64);
@@ -563,7 +563,9 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
563563

564564
named[section][method] = objectSpread({ method, name: `${_section}_${_method}`, section, sectionHash }, def);
565565
}
566-
} else {
566+
}
567+
} else {
568+
for (let i = 0, scount = sections.length; i < scount; i++) {
567569
const [_section, secs] = sections[i];
568570
const sectionHash = blake2AsHex(_section, 64);
569571
const rtApi = apis.find(([a]) => a.eq(sectionHash));
@@ -594,21 +596,21 @@ export abstract class Decorate<ApiType extends ApiTypes> extends Events {
594596
older.push(`${_section}/${rtApi[1].toString()} (${all.join('/')} known)`);
595597
}
596598
}
599+
}
597600

598-
// find the runtimes that we don't have hashes for
599-
const notFound = apis
600-
.map(([a, v]): [HexString, string] => [a.toHex(), v.toString()])
601-
.filter(([a]) => !hashes[a])
602-
.map(([a, v]) => `${this._runtimeMap[a] || a}/${v}`);
601+
// find the runtimes that we don't have hashes for
602+
const notFound = apis
603+
.map(([a, v]): [HexString, string] => [a.toHex(), v.toString()])
604+
.filter(([a]) => !hashes[a])
605+
.map(([a, v]) => `${this._runtimeMap[a] || a}/${v}`);
603606

604-
if (!this._options.noInitWarn && !hasLogged) {
605-
if (older.length) {
606-
l.warn(`${implName}: Not decorating runtime apis without matching versions: ${older.join(', ')}`);
607-
}
607+
if (!this._options.noInitWarn && !hasLogged) {
608+
if (older.length) {
609+
l.warn(`${implName}: Not decorating runtime apis without matching versions: ${older.join(', ')}`);
610+
}
608611

609-
if (notFound.length) {
610-
l.warn(`${implName}: Not decorating unknown runtime apis: ${notFound.join(', ')}`);
611-
}
612+
if (notFound.length) {
613+
l.warn(`${implName}: Not decorating unknown runtime apis: ${notFound.join(', ')}`);
612614
}
613615
}
614616
}

0 commit comments

Comments
 (0)