Unverified Commit 65122151 authored by mvdbeek's avatar mvdbeek
Browse files

Attempt to use epoch of client build time for cache busting

Store webpack build hash in meta.json file, and use that to setup
the cache busting.
This should prevent clients from unnecessarily reloading client bundles
when the server restarts and/or when individual workers finish booting
at staggered intervals.
This became more important with usegalaxy.org not forking off workers
from a preloaded master (so all workers would have the same starttime).
parent 6f7a3616
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ lib/galaxy.egg-info
lib/galaxy/web/framework/static/maps
lib/galaxy/web/framework/static/scripts
lib/galaxy/web/framework/static/style
lib/galaxy/web/framework/meta.json

# Database stuff
/database/
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
    "date-fns-tz": "^1.3.3",
    "decode-uri-component": "^0.2.0",
    "dom-to-image": "^2.6.0",
    "dumpmeta-webpack-plugin": "^0.2.0",
    "elkjs": "^0.7.1",
    "file-saver": "^2.0.5",
    "flush-promises": "^1.0.2",
+9 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ const VueLoaderPlugin = require("vue-loader/lib/plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const DuplicatePackageCheckerPlugin = require("@cerner/duplicate-package-checker-webpack-plugin");
const { DumpMetaPlugin } = require("dumpmeta-webpack-plugin");

const scriptsBase = path.join(__dirname, "src");
const testsBase = path.join(__dirname, "tests");
@@ -200,6 +201,14 @@ module.exports = (env = {}, argv = {}) => {
                filename: "[name].css",
            }),
            new DuplicatePackageCheckerPlugin(),
            new DumpMetaPlugin({
                filename: path.join(__dirname, "../lib/galaxy/web/framework/meta.json"),
                prepare: (stats) => ({
                    // add any other information you need to dump
                    hash: stats.hash,
                    epoch: Date.now(),
                }),
            }),
        ],
        devServer: {
            client: {
+7 −0
Original line number Diff line number Diff line
@@ -3855,6 +3855,13 @@ dot-case@^3.0.4:
    no-case "^3.0.4"
    tslib "^2.0.3"

dumpmeta-webpack-plugin@^0.2.0:
  version "0.2.0"
  resolved "https://registry.yarnpkg.com/dumpmeta-webpack-plugin/-/dumpmeta-webpack-plugin-0.2.0.tgz#c3a9da7d163ad3bb1d0373fb2c0bf5bb9b626b8f"
  integrity sha512-9oxLTPvYVtk7HOmOq2rGQlvajCNiXtIKLInIrdNpdgzeoMMELaAsRsRBZfm6xf0JuwyBfytdJxsmtM6luTeqzA==
  dependencies:
    webpack ">=4.0.0 <6.0.0"

duplexify@^3.6.0:
  version "3.7.1"
  resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.7.1.tgz#2a4df5317f6ccfd91f86d6fd25d8d8a103b88309"
+2 −1
Original line number Diff line number Diff line
@@ -123,6 +123,7 @@ from galaxy.web import (
    legacy_url_for,
    url_for,
)
from galaxy.web.framework.base import server_starttime
from galaxy.web.proxy import ProxyManager
from galaxy.web.short_term_storage import (
    ShortTermStorageAllocator,
@@ -739,7 +740,7 @@ class UniverseApplication(StructuredApp, GalaxyManagerApplication):
        self.url_for = url_for
        self.legacy_url_for = legacy_url_for

        self.server_starttime = int(time.time())  # used for cachebusting
        self.server_starttime = server_starttime  # used for cachebusting
        # Limit lifetime of tool shed repository cache to app startup
        self.tool_shed_repository_cache = None
        self.api_spec = None
Loading