server/src/Workers/index.js
/**
 * Method to delete the inactive images from S3 bucket.
 */
Method to delete the inactive images from S3 bucket.
Method to delete the inactive images from S3 bucket .
function deleteImages() {
   scheduler.scheduleJob('30 2 * * 0', () => {
      database.runSp(constants.SP_GET_IN_ACTIVE_IMAGES, []).then(_resultSet => {
         const result = _resultSet[0];
         let imageKeys = [];
         result.forEach(oneResult => {
            imageKeys.push(oneResult[constants.VENDOR_IMAGES_IMAGE_KEY]);
         });
         s3Helper.deleteObjects(imageKeys, false).then(() => {
            printer.printHighlightedLog("In active Images Deleted.");
         }).catch(err => {
            printer.printError(err);
         });
      }).catch(err => {
         printer.printError(err);
      });
   });
}
function deleteImages ( ) { scheduler . scheduleJob ( '30 2 * * 0' , ( ) => { database . runSp ( constants . SP_GET_IN_ACTIVE_IMAGES , [ ] ) . then ( _resultSet => { const result = _resultSet [ 0 ] ; let imageKeys = [ ] ; result . forEach ( oneResult => { imageKeys . push ( oneResult [ constants . VENDOR_IMAGES_IMAGE_KEY ] ) ; } ) ; s3Helper . deleteObjects ( imageKeys , false ) . then ( ( ) => { printer . printHighlightedLog ( "In active Images Deleted." ) ; } ) . catch ( err => { printer . printError ( err ) ; } ) ; } ) . catch ( err => { printer . printError ( err ) ; } ) ; } ) ; }
Method to delete the inactive images from S3 bucket.
Method to delete the inactive images from S3 bucket .