Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // "METHODS"
  2. SearchUtils.prototype.run = function() {
  3.     this.getScraperContainersListPromise()
  4.         .then((containers) => {
  5.             for (let i = 0; i < containers.length; i++) {
  6.                 if (containers[i].Names.toString().indexOf("scraper") !== -1) {
  7.                     this.addToScraperList(containers[i].Id, "wait");
  8.                 }
  9.             }
  10.         }, (err)=>{console.log(err)})
  11.         .then(()=>{
  12.             return this.checkReadyScraper();
  13.         },(err)=>{console.log(err)})
  14.         .then(() => {
  15.             this.scrap();
  16.         }, (err)=>{console.log(err)});
  17. };
  18.  
  19. SearchUtils.prototype.checkReadyScraper = function() {
  20.     return new Promise ((resolve, reject)=>{
  21.         for (let i = 0; i < this.scraperListId.length; i++) {
  22.             this.exec("getStatus", this.scraperListId[i].id);
  23.         }
  24.         resolve();
  25.     });
  26. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement