[pgAdmin][RM4681] Increase cache control max age for static files

Aditya Toshniwal <[email protected]>
Newsgroups gmane.comp.db.postgresql.pgadmin.devel
Message-ID <CAM9w-_n_yao4qbLxS3-ZttOAHJTGF1uYFsf+R+geCmpUAuVqzQ@mail.gmail.com>
Hi Hackers,

Attached is the patch to increase cache control max age (in http header)
for static files to improve performance over longer run.
By default it is 43200 seconds (12 hrs), which means that the static files
like vendor.js, etc. will be fetched again from server after 12hrs. This is
not required as these files won't change.

Kindly review.

-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"
RM4681.patch (application/octet-stream, 547 B)
diff --git a/web/config.py b/web/config.py
index 9e745bb6..162d9ab9 100644
--- a/web/config.py
+++ b/web/config.py
@@ -163,6 +163,9 @@ SECURITY_PASSWORD_HASH = 'pbkdf2_sha512'
 #       has no effect on <= Python 2.7.
 MINIFY_PAGE = True
 
+# Set the cache control max age for static files in flask to 1 year
+SEND_FILE_MAX_AGE_DEFAULT = 31556952
+
 # This will be added to static urls as url parameter with value as
 # APP_VERSION_INT for cache busting on version upgrade. If the value is set as
 # None or empty string then it will not be added.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.