Skip to content

Commit

Permalink
Merge pull request #718 from Accenture/bugfix/717-relevant-folders-fo…
Browse files Browse the repository at this point in the history
…r-list-not-always-cached

#717: ensure relevant folders are always (re-)cached when lists are cached
  • Loading branch information
JoernBerkefeld authored Feb 7, 2023
2 parents 93b2f42 + 46b2f91 commit 4a5dbc9
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions lib/metadataTypes/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,23 @@ class List extends MetadataType {
*/
static async retrieveForCache() {
const results = await this.retrieve();
if (!cache.getCache()?.folder) {
const subTypeArr = [
'list',
'mysubs',
'suppression_list',
'publication',
'contextual_suppression_list',
];
Util.logger.debug('folders not cached but required for list');
Util.logger.info(' - Caching dependent Metadata: folder');
Util.logSubtypes(subTypeArr);
Folder.client = this.client;
Folder.buObject = this.buObject;
Folder.properties = this.properties;
const result = await Folder.retrieveForCache(null, subTypeArr);
const subTypeArr = [
'list',
'mysubs',
'suppression_list',
'publication',
'contextual_suppression_list',
];
Util.logger.debug('folders not cached but required for list');
Util.logger.info(' - Caching dependent Metadata: folder');
Util.logSubtypes(subTypeArr);
Folder.client = this.client;
Folder.buObject = this.buObject;
Folder.properties = this.properties;
const result = await Folder.retrieveForCache(null, subTypeArr);
if (cache.getCache()?.folder) {
cache.mergeMetadata('folder', result.metadata);
} else {
cache.setMetadata('folder', result.metadata);
}
for (const metadataEntry in results.metadata) {
Expand Down

0 comments on commit 4a5dbc9

Please sign in to comment.