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

RUBY-2807 - Compression warning (proof-of-concept) #2778

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/reference/create-client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,12 @@ Ruby Options
- ``Array<String>``
- none

* - ``:warn_compression_disabled``
- By default, the driver warns if you have not set the ``:compressors`` option.
Set this option ``false`` to silence the warning.
- ``true``, ``false``
- none

* - ``:connect``
- **Deprecated.** Disables deployment topology discovery normally
performed by the dirver and forces the cluster topology to a specific
Expand Down
7 changes: 7 additions & 0 deletions lib/mongo/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,13 @@ def validate_new_options!(opts)
end
_options
end

unless !opts[:compressors]&.empty? ||
opts[:warn_compression_disabled] == false ||
@@warned_compression_disabled
log_warn("Compression is disabled. Refer to: https://www.mongodb.com/docs/ruby-driver/current/reference/create-client/#compression. You may silence this warning by setting :warn_compression_disabled = false.")
@@warned_compression_disabled = true
end
end

# Validates all options after they are set on the client.
Expand Down