Subversion Repositories SmartDukaan

Rev

Rev 37472 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 37472 Rev 37673
Line 17... Line 17...
17
import org.openqa.selenium.support.ui.WebDriverWait;
17
import org.openqa.selenium.support.ui.WebDriverWait;
18
import com.smartdukaan.cron.monitored.ImeiActivationGauges;
18
import com.smartdukaan.cron.monitored.ImeiActivationGauges;
19
import org.springframework.beans.factory.annotation.Autowired;
19
import org.springframework.beans.factory.annotation.Autowired;
20
import org.springframework.stereotype.Component;
20
import org.springframework.stereotype.Component;
21
 
21
 
-
 
22
import com.spice.profitmandi.common.util.BrowserLane;
-
 
23
 
22
import javax.imageio.ImageIO;
24
import javax.imageio.ImageIO;
23
import java.awt.image.BufferedImage;
25
import java.awt.image.BufferedImage;
24
import java.io.File;
26
import java.io.File;
25
import java.time.LocalDate;
27
import java.time.LocalDate;
26
import java.time.format.DateTimeFormatter;
28
import java.time.format.DateTimeFormatter;
Line 88... Line 90...
88
                "--disable-extensions"
90
                "--disable-extensions"
89
        );
91
        );
90
 
92
 
91
        WebDriver driver = null;
93
        WebDriver driver = null;
92
 
94
 
-
 
95
        // One driver tree on this box at a time -- see BrowserLane. Realme gives up the same way
-
 
96
        // oppo does: the imeis stay pending and the lane's next turn picks them up.
-
 
97
        BrowserLane lane = BrowserLane.acquire(BRAND, 5, TimeUnit.MINUTES);
-
 
98
        if (lane == null) {
-
 
99
            return dateMap;
-
 
100
        }
-
 
101
 
93
        try {
102
        try {
94
            driver = new ChromeDriver(options);
103
            driver = new ChromeDriver(options);
95
            driver.manage().timeouts().setScriptTimeout(6, TimeUnit.SECONDS);
104
            driver.manage().timeouts().setScriptTimeout(6, TimeUnit.SECONDS);
96
            driver.manage().window().setSize(new Dimension(1600, 900));
105
            driver.manage().window().setSize(new Dimension(1600, 900));
97
            driver.manage().window().maximize();
106
            driver.manage().window().maximize();
Line 281... Line 290...
281
                    driver.quit();  // Always shuts everything down
290
                    driver.quit();  // Always shuts everything down
282
                } catch (Exception e) {
291
                } catch (Exception e) {
283
                    LOGGER.warn("Error closing driver: " + e.getMessage());
292
                    LOGGER.warn("Error closing driver: " + e.getMessage());
284
                }
293
                }
285
            }
294
            }
-
 
295
            // After quit(), not before: the 850MB is resident for the whole chunk.
-
 
296
            lane.close();
286
        }
297
        }
287
 
298
 
288
        return dateMap;
299
        return dateMap;
289
    }
300
    }
290
 
301