Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Store client protocol on Agent #684

Merged
merged 1 commit into from
Oct 15, 2024
Merged

✨ Store client protocol on Agent #684

merged 1 commit into from
Oct 15, 2024

Conversation

alecgibson
Copy link
Collaborator

When developing new features, it will be useful to be able to compare server and client protocol versions.

For example, if a server is ahead of an old client, the server could gracefully degrade performance for clients that don't support the new functionality.

This change stores the client's protocol on the Agent so we can perform these checks.

We also add a checkAtLeast() protocol helper function, and store the current protocol in a constant to avoid magic numbers.

@coveralls
Copy link

coveralls commented Oct 7, 2024

Coverage Status

coverage: 97.481% (+0.01%) from 97.47%
when pulling ad9aa7e on client-protocol
into 945dc50 on master.

When developing new features, it will be useful to be able to compare
server and client protocol versions.

For example, if a server is ahead of an old client, the server could
gracefully degrade performance for clients that don't support the new
functionality.

This change stores the client's protocol on the `Agent` so we can
perform these checks.

We also add a `checkAtLeast()` protocol helper function, and store the
current protocol in a constant to avoid magic numbers.
lib/protocol.js Outdated
Comment on lines 10 to 12
return toCheck.major >= checkAgainst.major &&
toCheck.minor >= checkAgainst.minor;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This check would fail 2.0 > 1.1

lib/client/connection.js Show resolved Hide resolved
@alecgibson alecgibson merged commit 6a2c194 into master Oct 15, 2024
8 checks passed
@alecgibson alecgibson deleted the client-protocol branch October 15, 2024 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants