Page MenuHomePhabricator

[chronik-client] Added a mechanism for automatically selecting the fastest responding node, supporting two strategies: AsOrdered and ClosestFirst.
Needs RevisionPublic

Authored by alitayin on Tue, Apr 8, 19:32.

Details

Reviewers
Fabien
bytesofman
emack
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Summary

This code implements an automatic node selection mechanism to avoid always using a single node.

A static method useStrategy is introduced in the ChronikClient class.

Users can enable automatic node selection by calling ChronikClient.useStrategy(ConnectionStrategy.ClosestFirst, urls).

This method will return a list of node URLs sorted by latency based on measureWebsocketLatency responses during instantiation.

Depends on D17935

Test Plan

npm test, Added some testing functions

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
modules/chronik-client/src/ChronikClient.ts
20 ↗(On Diff #53448)

why do you need to export everything. Really only the ChronikClient should be public

34 ↗(On Diff #53448)

No need to make it optional here

36 ↗(On Diff #53448)

I'm not sure you need this ? It's already async

37 ↗(On Diff #53448)

move it below to avoid measuring the timeout setup. It likely shouldn't matter in practice but better do it correctly anyway

38 ↗(On Diff #53448)

This could leave the websocket open

53 ↗(On Diff #53448)

same here

66 ↗(On Diff #53448)

from our offline discussion it's probably not worth it and can be removed

134 ↗(On Diff #53448)

The timeout being a parameter, you can't print an hardcoded 1s here

139 ↗(On Diff #53448)

This is not useful imo

141 ↗(On Diff #53448)

You go just remove this else branch. If all urls timed out then print them all > 1s and the ordering will remain

169 ↗(On Diff #53448)

If this has a default value here, remove the default value in the callee. But as per the other comment, better just remove it. It's unlikely to get used ever and easy to add later if required

179 ↗(On Diff #53448)

You should rather log this with the above message, that's useful info

modules/chronik-client/src/failoverProxy.ts
52 ↗(On Diff #53448)

oupsy

54 ↗(On Diff #53448)

This change is good but please do it in another diff, it's not related and there is no reason to delay this improvement because the larger feature needs more review

94 ↗(On Diff #53448)

This could also benefit from being its own refactor diff: move appendWsUrls outside of FailoverProxy and update the tests to use the function instead of the method. Then you can rebase this diff on top

123 ↗(On Diff #53448)

Please don't introduce unrelated changes like this - even a newline - on code that is not touched by this diff.

This revision now requires changes to proceed.Fri, Apr 11, 08:41
modules/chronik-client/src/ChronikClient.ts
20 ↗(On Diff #53448)

👍

34 ↗(On Diff #53448)

👌

36 ↗(On Diff #53448)

Even though it's in async, Ws is event-driven, so even within async, it needs to be wrapped in a Promise. The type checking on line 35 can be simplified but it's not necessary.

38 ↗(On Diff #53448)

Wow, indeed. So, the _websocketUrlConnects in failoverProxy also has this issue. Should I fix it in this diff, or submit it with the URL issue in the next diff?

66 ↗(On Diff #53448)

👌

modules/chronik-client/src/failoverProxy.ts
94 ↗(On Diff #53448)

Can I keep this forwarding method, and then remove it in the next diff and update it in the test?

modules/chronik-client/src/ChronikClient.ts
38 ↗(On Diff #53448)

Good point. Please fix all the issues individually. I prefer 1000 diffs fixing 1 problem rather than 1 diff fixing 1000 problems

modules/chronik-client/src/failoverProxy.ts
94 ↗(On Diff #53448)

Please don't do that when you have the option to avoid it. This solution leaves the repo with some useless code to be removed, which my suggestion is avoiding. The rebase is not difficult in this case also

Based on what was mentioned earlier, I first moved appendWsUrls out of the class in D17935 and reused it here.
Additionally, I removed the concurrent and batch settings, and optimized and streamlined the Sort function (the
original sort function considered multiple rounds of testing, making the code more complicated)

modules/chronik-client/src/ChronikClient.ts
53 ↗(On Diff #53492)

No need to close here, because that the WS was not established

Directly return -1 in measureWebsocketLatency for timeout cases

Fabien requested changes to this revision.Tue, Apr 15, 14:17

A nit and a question, but it's getting there. Also you lost the test at some point, please bring it back.

modules/chronik-client/src/ChronikClient.ts
79 ↗(On Diff #53493)

What is the benefit of using -1 versus Infinity ? Can't Infinity be used in arithmetic operations ?

91 ↗(On Diff #53493)

just use ms here as well (with rounding) so the print is consistent and you can change the default without changing this function (e.g. 1500ms)

This revision now requires changes to proceed.Tue, Apr 15, 14:17

Also please keep the title/summary up to date

modules/chronik-client/src/ChronikClient.ts
79 ↗(On Diff #53493)

If it's -1, it can directly participate in the sorting process

91 ↗(On Diff #53493)

make sense. the cache in my brain was still "second" lol

modules/chronik-client/src/ChronikClient.ts
79 ↗(On Diff #53493)

Infinity can also be directly sorted... but keeping -1 is also consistent with API behavior and equally concise.

In the original version, I designed a complex method, such as testing nodes 10 times, and sorting them based on the number of times Infinity appeared - the more Infinity occurrences, the further back in the sort order, lol. Actually, it's not necessary. Keeping Infinity also works.

Do you think we should change it back to Infinity?

modules/chronik-client/src/ChronikClient.ts
79 ↗(On Diff #53493)

I have the feeling that using Infinity will let you rewrite your sorting as so:

results.sort((a, b) => {
    return a.latency - b.latency;
});

This is assuming Infinity == Infinity is true

Keep using Infinity, adjust the output to display in ms

modules/chronik-client/src/ChronikClient.ts
79 ↗(On Diff #53493)

👍 You are right.

add test, in the test, i don't mock measureWebsocketLatency, but instead use asynchronous actual testing to
keep it simple.

alitayin edited the test plan for this revision. (Show Details)
Fabien requested changes to this revision.Tue, Apr 15, 20:26

You have a rebase issue.
Don't use real urls in tests, mocking the time is much better as it doesn't depend on some server status. E.g. if chronik1.alitayin.com is down your second test is identical to the first one, and there is no way to tell

This revision now requires changes to proceed.Tue, Apr 15, 20:26

Tail of the build log:

npm error Missing: imurmurhash@0.1.4 from lock file
npm error Missing: is-path-inside@3.0.3 from lock file
npm error Missing: json-stable-stringify-without-jsonify@1.0.1 from lock file
npm error Missing: levn@0.4.1 from lock file
npm error Missing: lodash.merge@4.6.2 from lock file
npm error Missing: natural-compare@1.4.0 from lock file
npm error Missing: optionator@0.9.4 from lock file
npm error Missing: text-table@0.2.0 from lock file
npm error Missing: import-fresh@3.3.1 from lock file
npm error Missing: @humanwhocodes/object-schema@2.0.3 from lock file
npm error Missing: @nodelib/fs.scandir@2.1.5 from lock file
npm error Missing: fastq@1.19.1 from lock file
npm error Missing: @nodelib/fs.stat@2.0.5 from lock file
npm error Missing: run-parallel@1.2.0 from lock file
npm error Missing: fast-json-stable-stringify@2.1.0 from lock file
npm error Missing: json-schema-traverse@0.4.1 from lock file
npm error Missing: uri-js@4.4.1 from lock file
npm error Missing: path-key@3.1.1 from lock file
npm error Missing: shebang-command@2.0.0 from lock file
npm error Missing: esrecurse@4.3.0 from lock file
npm error Missing: estraverse@5.3.0 from lock file
npm error Missing: acorn-jsx@5.3.2 from lock file
npm error Missing: reusify@1.1.0 from lock file
npm error Missing: flat-cache@3.2.0 from lock file
npm error Missing: flatted@3.3.3 from lock file
npm error Missing: keyv@4.5.4 from lock file
npm error Missing: rimraf@3.0.2 from lock file
npm error Missing: type-fest@0.20.2 from lock file
npm error Missing: parent-module@1.0.1 from lock file
npm error Missing: resolve-from@4.0.0 from lock file
npm error Missing: json-buffer@3.0.1 from lock file
npm error Missing: prelude-ls@1.2.1 from lock file
npm error Missing: type-check@0.4.0 from lock file
npm error Missing: deep-is@0.1.4 from lock file
npm error Missing: fast-levenshtein@2.0.6 from lock file
npm error Missing: word-wrap@1.2.5 from lock file
npm error Missing: callsites@3.1.0 from lock file
npm error Missing: queue-microtask@1.2.3 from lock file
npm error Missing: shebang-regex@3.0.0 from lock file
npm error Missing: punycode@2.3.1 from lock file
npm error
npm error Clean install a project
npm error
npm error Usage:
npm error npm ci
npm error
npm error Options:
npm error [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
npm error [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
npm error [--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]]
npm error [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit]
npm error [--no-bin-links] [--no-fund] [--dry-run]
npm error [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm error [-ws|--workspaces] [--include-workspace-root] [--install-links]
npm error
npm error aliases: clean-install, ic, install-clean, isntall-clean
npm error
npm error Run "npm help ci" for more info
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-04-16T09_54_57_829Z-debug-0.log
Build ecash-herald-tests failed with exit code 1

Tail of the build log:

npm error Missing: imurmurhash@0.1.4 from lock file
npm error Missing: is-path-inside@3.0.3 from lock file
npm error Missing: json-stable-stringify-without-jsonify@1.0.1 from lock file
npm error Missing: levn@0.4.1 from lock file
npm error Missing: lodash.merge@4.6.2 from lock file
npm error Missing: natural-compare@1.4.0 from lock file
npm error Missing: optionator@0.9.4 from lock file
npm error Missing: text-table@0.2.0 from lock file
npm error Missing: import-fresh@3.3.1 from lock file
npm error Missing: @humanwhocodes/object-schema@2.0.3 from lock file
npm error Missing: @nodelib/fs.scandir@2.1.5 from lock file
npm error Missing: fastq@1.19.1 from lock file
npm error Missing: @nodelib/fs.stat@2.0.5 from lock file
npm error Missing: run-parallel@1.2.0 from lock file
npm error Missing: fast-json-stable-stringify@2.1.0 from lock file
npm error Missing: json-schema-traverse@0.4.1 from lock file
npm error Missing: uri-js@4.4.1 from lock file
npm error Missing: path-key@3.1.1 from lock file
npm error Missing: shebang-command@2.0.0 from lock file
npm error Missing: esrecurse@4.3.0 from lock file
npm error Missing: estraverse@5.3.0 from lock file
npm error Missing: acorn-jsx@5.3.2 from lock file
npm error Missing: reusify@1.1.0 from lock file
npm error Missing: flat-cache@3.2.0 from lock file
npm error Missing: flatted@3.3.3 from lock file
npm error Missing: keyv@4.5.4 from lock file
npm error Missing: rimraf@3.0.2 from lock file
npm error Missing: type-fest@0.20.2 from lock file
npm error Missing: parent-module@1.0.1 from lock file
npm error Missing: resolve-from@4.0.0 from lock file
npm error Missing: json-buffer@3.0.1 from lock file
npm error Missing: prelude-ls@1.2.1 from lock file
npm error Missing: type-check@0.4.0 from lock file
npm error Missing: deep-is@0.1.4 from lock file
npm error Missing: fast-levenshtein@2.0.6 from lock file
npm error Missing: word-wrap@1.2.5 from lock file
npm error Missing: callsites@3.1.0 from lock file
npm error Missing: queue-microtask@1.2.3 from lock file
npm error Missing: shebang-regex@3.0.0 from lock file
npm error Missing: punycode@2.3.1 from lock file
npm error
npm error Clean install a project
npm error
npm error Usage:
npm error npm ci
npm error
npm error Options:
npm error [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
npm error [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
npm error [--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]]
npm error [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit]
npm error [--no-bin-links] [--no-fund] [--dry-run]
npm error [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm error [-ws|--workspaces] [--include-workspace-root] [--install-links]
npm error
npm error aliases: clean-install, ic, install-clean, isntall-clean
npm error
npm error Run "npm help ci" for more info
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-04-16T09_55_21_061Z-debug-0.log
Build chronik-client-tests failed with exit code 1

Tail of the build log:

npm error Missing: imurmurhash@0.1.4 from lock file
npm error Missing: is-path-inside@3.0.3 from lock file
npm error Missing: json-stable-stringify-without-jsonify@1.0.1 from lock file
npm error Missing: levn@0.4.1 from lock file
npm error Missing: lodash.merge@4.6.2 from lock file
npm error Missing: natural-compare@1.4.0 from lock file
npm error Missing: optionator@0.9.4 from lock file
npm error Missing: text-table@0.2.0 from lock file
npm error Missing: import-fresh@3.3.1 from lock file
npm error Missing: @humanwhocodes/object-schema@2.0.3 from lock file
npm error Missing: @nodelib/fs.scandir@2.1.5 from lock file
npm error Missing: fastq@1.19.1 from lock file
npm error Missing: @nodelib/fs.stat@2.0.5 from lock file
npm error Missing: run-parallel@1.2.0 from lock file
npm error Missing: fast-json-stable-stringify@2.1.0 from lock file
npm error Missing: json-schema-traverse@0.4.1 from lock file
npm error Missing: uri-js@4.4.1 from lock file
npm error Missing: path-key@3.1.1 from lock file
npm error Missing: shebang-command@2.0.0 from lock file
npm error Missing: esrecurse@4.3.0 from lock file
npm error Missing: estraverse@5.3.0 from lock file
npm error Missing: acorn-jsx@5.3.2 from lock file
npm error Missing: reusify@1.1.0 from lock file
npm error Missing: flat-cache@3.2.0 from lock file
npm error Missing: flatted@3.3.3 from lock file
npm error Missing: keyv@4.5.4 from lock file
npm error Missing: rimraf@3.0.2 from lock file
npm error Missing: type-fest@0.20.2 from lock file
npm error Missing: parent-module@1.0.1 from lock file
npm error Missing: resolve-from@4.0.0 from lock file
npm error Missing: json-buffer@3.0.1 from lock file
npm error Missing: prelude-ls@1.2.1 from lock file
npm error Missing: type-check@0.4.0 from lock file
npm error Missing: deep-is@0.1.4 from lock file
npm error Missing: fast-levenshtein@2.0.6 from lock file
npm error Missing: word-wrap@1.2.5 from lock file
npm error Missing: callsites@3.1.0 from lock file
npm error Missing: queue-microtask@1.2.3 from lock file
npm error Missing: shebang-regex@3.0.0 from lock file
npm error Missing: punycode@2.3.1 from lock file
npm error
npm error Clean install a project
npm error
npm error Usage:
npm error npm ci
npm error
npm error Options:
npm error [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
npm error [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
npm error [--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]]
npm error [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit]
npm error [--no-bin-links] [--no-fund] [--dry-run]
npm error [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm error [-ws|--workspaces] [--include-workspace-root] [--install-links]
npm error
npm error aliases: clean-install, ic, install-clean, isntall-clean
npm error
npm error Run "npm help ci" for more info
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-04-16T09_55_23_553Z-debug-0.log
Build token-server-tests failed with exit code 1

Tail of the build log:

npm error Missing: imurmurhash@0.1.4 from lock file
npm error Missing: is-path-inside@3.0.3 from lock file
npm error Missing: json-stable-stringify-without-jsonify@1.0.1 from lock file
npm error Missing: levn@0.4.1 from lock file
npm error Missing: lodash.merge@4.6.2 from lock file
npm error Missing: natural-compare@1.4.0 from lock file
npm error Missing: optionator@0.9.4 from lock file
npm error Missing: text-table@0.2.0 from lock file
npm error Missing: import-fresh@3.3.1 from lock file
npm error Missing: @humanwhocodes/object-schema@2.0.3 from lock file
npm error Missing: @nodelib/fs.scandir@2.1.5 from lock file
npm error Missing: fastq@1.19.1 from lock file
npm error Missing: @nodelib/fs.stat@2.0.5 from lock file
npm error Missing: run-parallel@1.2.0 from lock file
npm error Missing: fast-json-stable-stringify@2.1.0 from lock file
npm error Missing: json-schema-traverse@0.4.1 from lock file
npm error Missing: uri-js@4.4.1 from lock file
npm error Missing: path-key@3.1.1 from lock file
npm error Missing: shebang-command@2.0.0 from lock file
npm error Missing: esrecurse@4.3.0 from lock file
npm error Missing: estraverse@5.3.0 from lock file
npm error Missing: acorn-jsx@5.3.2 from lock file
npm error Missing: reusify@1.1.0 from lock file
npm error Missing: flat-cache@3.2.0 from lock file
npm error Missing: flatted@3.3.3 from lock file
npm error Missing: keyv@4.5.4 from lock file
npm error Missing: rimraf@3.0.2 from lock file
npm error Missing: type-fest@0.20.2 from lock file
npm error Missing: parent-module@1.0.1 from lock file
npm error Missing: resolve-from@4.0.0 from lock file
npm error Missing: json-buffer@3.0.1 from lock file
npm error Missing: prelude-ls@1.2.1 from lock file
npm error Missing: type-check@0.4.0 from lock file
npm error Missing: deep-is@0.1.4 from lock file
npm error Missing: fast-levenshtein@2.0.6 from lock file
npm error Missing: word-wrap@1.2.5 from lock file
npm error Missing: callsites@3.1.0 from lock file
npm error Missing: queue-microtask@1.2.3 from lock file
npm error Missing: shebang-regex@3.0.0 from lock file
npm error Missing: punycode@2.3.1 from lock file
npm error
npm error Clean install a project
npm error
npm error Usage:
npm error npm ci
npm error
npm error Options:
npm error [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
npm error [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
npm error [--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]]
npm error [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit]
npm error [--no-bin-links] [--no-fund] [--dry-run]
npm error [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm error [-ws|--workspaces] [--include-workspace-root] [--install-links]
npm error
npm error aliases: clean-install, ic, install-clean, isntall-clean
npm error
npm error Run "npm help ci" for more info
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-04-16T09_55_24_615Z-debug-0.log
Build ecash-agora-integration-tests failed with exit code 1

Tail of the build log:

npm error Missing: imurmurhash@0.1.4 from lock file
npm error Missing: is-path-inside@3.0.3 from lock file
npm error Missing: json-stable-stringify-without-jsonify@1.0.1 from lock file
npm error Missing: levn@0.4.1 from lock file
npm error Missing: lodash.merge@4.6.2 from lock file
npm error Missing: natural-compare@1.4.0 from lock file
npm error Missing: optionator@0.9.4 from lock file
npm error Missing: text-table@0.2.0 from lock file
npm error Missing: import-fresh@3.3.1 from lock file
npm error Missing: @humanwhocodes/object-schema@2.0.3 from lock file
npm error Missing: @nodelib/fs.scandir@2.1.5 from lock file
npm error Missing: fastq@1.19.1 from lock file
npm error Missing: @nodelib/fs.stat@2.0.5 from lock file
npm error Missing: run-parallel@1.2.0 from lock file
npm error Missing: fast-json-stable-stringify@2.1.0 from lock file
npm error Missing: json-schema-traverse@0.4.1 from lock file
npm error Missing: uri-js@4.4.1 from lock file
npm error Missing: path-key@3.1.1 from lock file
npm error Missing: shebang-command@2.0.0 from lock file
npm error Missing: esrecurse@4.3.0 from lock file
npm error Missing: estraverse@5.3.0 from lock file
npm error Missing: acorn-jsx@5.3.2 from lock file
npm error Missing: reusify@1.1.0 from lock file
npm error Missing: flat-cache@3.2.0 from lock file
npm error Missing: flatted@3.3.3 from lock file
npm error Missing: keyv@4.5.4 from lock file
npm error Missing: rimraf@3.0.2 from lock file
npm error Missing: type-fest@0.20.2 from lock file
npm error Missing: parent-module@1.0.1 from lock file
npm error Missing: resolve-from@4.0.0 from lock file
npm error Missing: json-buffer@3.0.1 from lock file
npm error Missing: prelude-ls@1.2.1 from lock file
npm error Missing: type-check@0.4.0 from lock file
npm error Missing: deep-is@0.1.4 from lock file
npm error Missing: fast-levenshtein@2.0.6 from lock file
npm error Missing: word-wrap@1.2.5 from lock file
npm error Missing: callsites@3.1.0 from lock file
npm error Missing: queue-microtask@1.2.3 from lock file
npm error Missing: shebang-regex@3.0.0 from lock file
npm error Missing: punycode@2.3.1 from lock file
npm error
npm error Clean install a project
npm error
npm error Usage:
npm error npm ci
npm error
npm error Options:
npm error [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
npm error [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
npm error [--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]]
npm error [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit]
npm error [--no-bin-links] [--no-fund] [--dry-run]
npm error [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm error [-ws|--workspaces] [--include-workspace-root] [--install-links]
npm error
npm error aliases: clean-install, ic, install-clean, isntall-clean
npm error
npm error Run "npm help ci" for more info
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-04-16T09_55_42_105Z-debug-0.log
Build ecash-lib-integration-tests failed with exit code 1

Tail of the build log:

npm error Missing: imurmurhash@0.1.4 from lock file
npm error Missing: is-path-inside@3.0.3 from lock file
npm error Missing: json-stable-stringify-without-jsonify@1.0.1 from lock file
npm error Missing: levn@0.4.1 from lock file
npm error Missing: lodash.merge@4.6.2 from lock file
npm error Missing: natural-compare@1.4.0 from lock file
npm error Missing: optionator@0.9.4 from lock file
npm error Missing: text-table@0.2.0 from lock file
npm error Missing: import-fresh@3.3.1 from lock file
npm error Missing: @humanwhocodes/object-schema@2.0.3 from lock file
npm error Missing: @nodelib/fs.scandir@2.1.5 from lock file
npm error Missing: fastq@1.19.1 from lock file
npm error Missing: @nodelib/fs.stat@2.0.5 from lock file
npm error Missing: run-parallel@1.2.0 from lock file
npm error Missing: fast-json-stable-stringify@2.1.0 from lock file
npm error Missing: json-schema-traverse@0.4.1 from lock file
npm error Missing: uri-js@4.4.1 from lock file
npm error Missing: path-key@3.1.1 from lock file
npm error Missing: shebang-command@2.0.0 from lock file
npm error Missing: esrecurse@4.3.0 from lock file
npm error Missing: estraverse@5.3.0 from lock file
npm error Missing: acorn-jsx@5.3.2 from lock file
npm error Missing: reusify@1.1.0 from lock file
npm error Missing: flat-cache@3.2.0 from lock file
npm error Missing: flatted@3.3.3 from lock file
npm error Missing: keyv@4.5.4 from lock file
npm error Missing: rimraf@3.0.2 from lock file
npm error Missing: type-fest@0.20.2 from lock file
npm error Missing: parent-module@1.0.1 from lock file
npm error Missing: resolve-from@4.0.0 from lock file
npm error Missing: json-buffer@3.0.1 from lock file
npm error Missing: prelude-ls@1.2.1 from lock file
npm error Missing: type-check@0.4.0 from lock file
npm error Missing: deep-is@0.1.4 from lock file
npm error Missing: fast-levenshtein@2.0.6 from lock file
npm error Missing: word-wrap@1.2.5 from lock file
npm error Missing: callsites@3.1.0 from lock file
npm error Missing: queue-microtask@1.2.3 from lock file
npm error Missing: shebang-regex@3.0.0 from lock file
npm error Missing: punycode@2.3.1 from lock file
npm error
npm error Clean install a project
npm error
npm error Usage:
npm error npm ci
npm error
npm error Options:
npm error [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
npm error [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
npm error [--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]]
npm error [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit]
npm error [--no-bin-links] [--no-fund] [--dry-run]
npm error [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
npm error [-ws|--workspaces] [--include-workspace-root] [--install-links]
npm error
npm error aliases: clean-install, ic, install-clean, isntall-clean
npm error
npm error Run "npm help ci" for more info
npm error A complete log of this run can be found in: /root/.npm/_logs/2025-04-16T09_58_55_243Z-debug-0.log
Build chronik-client-integration-tests failed with exit code 1
Fabien requested changes to this revision.Wed, Apr 16, 10:52
Fabien added inline comments.
modules/chronik-client/test/test.ts
13 ↗(On Diff #53501)

that's unused, remove

201–204 ↗(On Diff #53501)

Can you use non contiguous urls, so we can see that relative ordering is preserved even if there is a "hole". Also include identical timings (see suggestion).
This should return the expected order:

[
    'https://chronik3.alitayin.com',
    'https://chronik1.alitayin.com',
    'https://chronik5.alitayin.com',
    'https://chronik2.alitayin.com',
    'https://chronik4.alitayin.com',
];
211 ↗(On Diff #53501)

Please use the full url string here. It makes it easier to read

246 ↗(On Diff #53501)

ditto

This revision now requires changes to proceed.Wed, Apr 16, 10:52
modules/chronik-client/src/ChronikClient.ts
30 ↗(On Diff #53501)
modules/chronik-client/test/test.ts
11 ↗(On Diff #53501)

maybe add a newline before this section

Some minor adjustments regarding the above.

Fabien requested changes to this revision.Wed, Apr 16, 13:10
Fabien added inline comments.
modules/chronik-client/test/test.ts
205 ↗(On Diff #53509)

Remove this line so we have a test for ordering preservation when 2 non consecutive urls return Infinity

This revision now requires changes to proceed.Wed, Apr 16, 13:10
  • Update the README with discussion of this feature and implementation example
  • Minor version bump (npm version minor)
  • Update changelog section of README with description of change associated with this version bump
This revision now requires changes to proceed.Wed, Apr 16, 16:50