@@ -838,62 +838,6 @@ class S3UtilsMongoClient extends MongoClientInterface {
838838 }
839839 }
840840
841- /*
842- * Overwrite the getBucketInfos method to specially handle the cases that
843- * bucket collection exists but bucket is not in metastore collection.
844- * For now, to make the count-items cronjob more robust, we ignore those "bad buckets"
845- */
846- async getBucketInfos ( log , cb ) {
847- try {
848- const bucketInfos = [ ] ;
849- const collInfos = await this . db . listCollections ( { type : 'collection' } ) . toArray ( ) ;
850- for ( const value of collInfos ) {
851- if ( this . _isSpecialCollection ( value . name ) ) {
852- // skip
853- continue ;
854- }
855- const bucketName = value . name ;
856- try {
857- // eslint-disable-next-line no-await-in-loop
858- const bucketInfo = await new Promise ( ( resolve , reject ) => {
859- this . getBucketAttributes ( bucketName , log , ( err , info ) => {
860- if ( err ) {
861- reject ( err ) ;
862- } else {
863- resolve ( info ) ;
864- }
865- } ) ;
866- } ) ;
867- bucketInfos . push ( bucketInfo ) ;
868- } catch ( err ) {
869- if ( err . message === 'NoSuchBucket' ) {
870- log . debug ( 'bucket does not exist in metastore, ignore it' , {
871- bucketName,
872- } ) ;
873- } else {
874- log . error ( 'failed to get bucket attributes' , {
875- bucketName,
876- errDetails : { ...err } ,
877- errorString : err . toString ( ) ,
878- } ) ;
879- throw errors . InternalError ;
880- }
881- }
882- }
883- return cb ( null , {
884- bucketCount : bucketInfos . length ,
885- bucketInfos,
886- } ) ;
887- } catch ( err ) {
888- log . error ( 'could not get list of collections' , {
889- method : '_getBucketInfos' ,
890- errDetails : { ...err } ,
891- errorString : err . toString ( ) ,
892- } ) ;
893- return cb ( err ) ;
894- }
895- }
896-
897841 async getUsersBucketCreationDate ( ownerId , bucketName , log , cb ) {
898842 try {
899843 const usersBucketCol = this . getCollection ( USERSBUCKET ) ;
0 commit comments