-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Issue 1424 - Latest flask-compress (1.6.0) breaks Dash #1426
Conversation
dash/dash.py
Outdated
# flask-compress==1.6.0 changed default to ['br', 'gzip'] | ||
# and non-overridable default compression with Brotli is | ||
# causing performance issues | ||
self.server.config["COMPRESS_ALGORITHM"] = ["gzip"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hesitant to override the values for servers passed as parameter https://github.com/plotly/dash/pull/1426/files#diff-228c9aefac729977642672aa1416bacaR277 as modifying a passed argument's settings would be unexpected, but maybe we don't really have a choice here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever we call Compress(self.server)
we're effectively modifying the server's settings - and by default we do this even for user-provided servers. Perhaps we can check whether server.config["COMPRESS_ALGORITHM"]
already has a value, and only set it if not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out that running the code above against 1.5.0
fails and there is no __version__
or VERSION
on flask_compress
so determining the version needs to be done through pkg_resources
. 01bfbcd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can check whether server.config["COMPRESS_ALGORITHM"] already has a value, and only set it if not?
@@ -1,5 +1,5 @@ | |||
Flask>=1.0.2 | |||
flask-compress==1.5.0 | |||
flask-compress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfix flask-compress
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 💃
Fixes #1424
Proposes to override the default
COMPRESSION_ALGORITHM
to['gzip']
so as to avoid the costly, and currently non-configurable, Brotli compression.