Skip to content

Commit

Permalink
Merge branch 'patch' into actions_update
Browse files Browse the repository at this point in the history
  • Loading branch information
RobAndrewHurst authored Oct 31, 2024
2 parents 25c1236 + 82c1832 commit 7327989
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions mod/workspace/_workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion mod/workspace/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion mod/workspace/getTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 7327989

Please sign in to comment.