diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 53935ed26..2cf63fc48 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -4,7 +4,7 @@ name: Deploy static content to Pages on: # Runs on pushes targeting the default branch push: - branches: [ "main", "major", "minor", "patch" ] + branches: [ "main" ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: diff --git a/mod/workspace/_workspace.js b/mod/workspace/_workspace.js index dceb986c1..7b2c82328 100644 --- a/mod/workspace/_workspace.js +++ b/mod/workspace/_workspace.js @@ -284,6 +284,8 @@ function roles(req, res) { @description The workspace/test method which is only available to user with admin credentials requests all locales in workspace. +The cached workspace will be flushed for the test method. + Requesting all locales should add any additional templates to the workspace. The test method will iterate over all workspace.templates and get from the getTemplate method to check whether any errors are logged on a template in regards to its src parameter. diff --git a/mod/workspace/cache.js b/mod/workspace/cache.js index 813ac1a2d..e0fd88e66 100644 --- a/mod/workspace/cache.js +++ b/mod/workspace/cache.js @@ -14,6 +14,7 @@ const getFrom = require('../provider/getFrom') const merge = require('../utils/merge') +// Assign default age in ms. process.env.WORKSPACE_AGE ??= 3600000 let cache = null @@ -28,7 +29,9 @@ const logger = require('../utils/logger') @description The method checks whether the module scope variable cache has been populated. -The age of the cached timestamp is checked against the WORKSPACE_AGE environment variable. +The timestamp set by cacheWorkspace is checked against the current time. The [workspace] cache will be invalidated if the difference exceeds the WORKSPACE_AGE environment variable. + +Setting the WORKSPACE_AGE to 0 is not recommended as this could cause the cache to be flushed while a request is passed through the XYZ API. A layer query processed by the [Query API module]{@link module:/query~layerQuery} will request the layer and associated locale which could be defined in remote templates. Each request to the [Workspace API getTemplate]{@link module:/workspace/getTemplate~getTemplate} method for the locale, layer, and query templates will call the checkWorkspaceCache method which will cause the workspace to be flushed and templates previously cached from their src no longer available. The cacheWorkspace method is called if the cache is invalid. diff --git a/mod/workspace/getTemplate.js b/mod/workspace/getTemplate.js index 76d4cfafe..9dbb5b14c 100644 --- a/mod/workspace/getTemplate.js +++ b/mod/workspace/getTemplate.js @@ -33,7 +33,7 @@ const envReplace = require('../utils/envReplace') @async @description -The workspace will be requested from the workspace/cache module. +The workspace will checked and cached by the [Workspace API checkWorkspaceCache]{@link module:/workspace/cache~checkWorkspaceCache} method. A template object matching the template_key param in the workspace.templates{} object will be returned from the getTemplate method.