Subversion Repositories SmartDukaan

Rev

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

Rev 37565 Rev 37788
Line 12... Line 12...
12
 
12
 
13
@Service
13
@Service
14
public class OppoImeiActivationService {
14
public class OppoImeiActivationService {
15
 
15
 
16
	private static final Logger LOGGER = LogManager.getLogger(OppoImeiActivationService.class);
16
	private static final Logger LOGGER = LogManager.getLogger(OppoImeiActivationService.class);
-
 
17
 
-
 
18
	private static final String BRAND = "Oppo";
17
	@Autowired
19
	@Autowired
18
	ActivatedImeiRepository activatedImeiRepository;
20
	ActivatedImeiRepository activatedImeiRepository;
19
	@Autowired
21
	@Autowired
20
	CheckOppoWarrantyTask checkOppoWarrantyTask;
22
	CheckOppoWarrantyTask checkOppoWarrantyTask;
21
 
23
 
Line 23... Line 25...
23
		Map<String, LocalDate> imeisDateMap = checkOppoWarrantyTask.checkWarranty(imeis);
25
		Map<String, LocalDate> imeisDateMap = checkOppoWarrantyTask.checkWarranty(imeis);
24
		imeisDateMap.forEach((serialNumber, date) -> {
26
		imeisDateMap.forEach((serialNumber, date) -> {
25
			LOGGER.info("Serial Number {} Date {}", serialNumber, date);
27
			LOGGER.info("Serial Number {} Date {}", serialNumber, date);
26
			activatedImeiRepository.saveActivation(serialNumber, date != null ? date.atStartOfDay() : null);
28
			activatedImeiRepository.saveActivation(serialNumber, date != null ? date.atStartOfDay() : null);
27
		});
29
		});
-
 
30
		// NOTHING answered means the failure was OURS, not a verdict on these imeis, so do
-
 
31
		// not stamp them. A per-imei failure is normal and still rests below; a whole chunk
-
 
32
		// failing is infrastructure -- a dead driver, an unreadable jar resource, the site
-
 
33
		// refusing every request -- and stamping it spends the pool on an outage. That is
-
 
34
		// exactly what happened on 2026-09-22: a ZipException on every WebDriver command
-
 
35
		// burned 3,920 realme and 4,824 oppo imeis in one day for 0 and 96 dates against a
-
 
36
		// normal 76-100%, and because the rows were stamped they will not be re-asked until
-
 
37
		// their rest expires. Leaving them unstamped costs a re-ask of the SAME chunk on the
-
 
38
		// next tick, which is loud and self-limiting, instead of quietly consuming the day.
-
 
39
		if (imeisDateMap.isEmpty() && imeis.size() > 1) {
-
 
40
			LOGGER.error("{} answered none of {} imeis - treating as infrastructure failure and"
-
 
41
					+ " leaving them unstamped rather than resting the whole chunk", BRAND, imeis.size());
-
 
42
			return;
-
 
43
		}
28
		restUnanswered(imeis, imeisDateMap);
44
		restUnanswered(imeis, imeisDateMap);
29
	}
45
	}
30
 
46
 
31
	/**
47
	/**
32
	 * Stamp the imeis that never reached an answer, so the chunk advances past them.
48
	 * Stamp the imeis that never reached an answer, so the chunk advances past them.