Page MenuHomePhabricator

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

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
Commits
rABC0eaa9c9c1589: [chronik-client] Added a mechanism for automatically selecting the fastest…
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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

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

update README.md and npm version minor

Fabien requested changes to this revision.Thu, Apr 17, 10:45
Fabien added inline comments.
modules/chronik-client/README.md
16 ↗(On Diff #53517)

The comment should be above the import line

18 ↗(On Diff #53517)

IMO the best option is to change this example to only use the useStrategy call (and have it only once), then add a comment to explain the different strategies.
The README should reflect the "normal" use case, and your code don't need to create twice the client.

24 ↗(On Diff #53517)

This one should be moved above new ChronikClient too...

This revision now requires changes to proceed.Thu, Apr 17, 10:45
Fabien requested changes to this revision.Thu, Apr 17, 12:14
Fabien added inline comments.
modules/chronik-client/README.md
14 ↗(On Diff #53529)

Now that this is the only method you show in the example this comment is no longer useful, remove it.

18 ↗(On Diff #53529)

The linter is not happy

This revision now requires changes to proceed.Thu, Apr 17, 12:14

Extra comments and trailing whitespace removed

This revision is now accepted and ready to land.Thu, Apr 17, 23:28