@@ -1156,16 +1156,21 @@ function Install(options) {
11561156 * Enumerate all meta objects of an adapter
11571157 * @type {(knownObjIDs: string[], adapter: string, metaFilesToDelete: string[]) => Promise<void> }
11581158 */
1159- this . enumerateAdapterMeta = function enumerateMeta ( knownObjIDs , adapter , metaFilesToDelete ) {
1160- return getObjectViewAsync ( 'system' , 'meta' , {
1161- startkey : `${ adapter } .` ,
1162- endkey : `${ adapter } .\u9999`
1163- } ) . then ( doc => {
1159+ this . enumerateAdapterMeta = async function enumerateMeta ( knownObjIDs , adapter , metaFilesToDelete ) {
1160+ try {
1161+ const doc = await getObjectViewAsync ( 'system' , 'meta' , {
1162+ startkey : `${ adapter } .` ,
1163+ endkey : `${ adapter } .\u9999`
1164+ } ) ;
1165+
11641166 if ( doc . rows . length !== 0 ) {
1167+ const adapterRegex = new RegExp ( `^${ adapter } \\.` ) ;
1168+
11651169 // add non-duplicates to the list
11661170 const newObjs = doc . rows
11671171 . filter ( row => row && row . value && row . value . _id )
11681172 . map ( row => row . value . _id )
1173+ . filter ( id => adapterRegex . test ( id ) )
11691174 . filter ( id => knownObjIDs . indexOf ( id ) === - 1 )
11701175 ;
11711176 knownObjIDs . push . apply ( knownObjIDs , newObjs ) ;
@@ -1176,8 +1181,9 @@ function Install(options) {
11761181 console . log ( `host.${ hostname } Counted ${ newObjs . length } meta of ${ adapter } ` ) ;
11771182 }
11781183 }
1179- } ) . catch ( e =>
1180- e !== tools . ERRORS . ERROR_NOT_FOUND && e . message !== tools . ERRORS . ERROR_NOT_FOUND && console . error ( 'host.' + hostname + ' error: ' + e . message ) ) ;
1184+ } catch ( e ) {
1185+ e !== tools . ERRORS . ERROR_NOT_FOUND && e . message !== tools . ERRORS . ERROR_NOT_FOUND && console . error ( `host.${ hostname } error: ${ e . message } ` ) ;
1186+ }
11811187 } ;
11821188
11831189 /**
@@ -1701,4 +1707,4 @@ function Install(options) {
17011707 } ;
17021708}
17031709
1704- module . exports = Install ;
1710+ module . exports = Install ;
0 commit comments