| Line 23... |
Line 23... |
| 23 |
Map<String, LocalDate> imeisDateMap = checkOppoWarrantyTask.checkWarranty(imeis);
|
23 |
Map<String, LocalDate> imeisDateMap = checkOppoWarrantyTask.checkWarranty(imeis);
|
| 24 |
imeisDateMap.forEach((serialNumber, date) -> {
|
24 |
imeisDateMap.forEach((serialNumber, date) -> {
|
| 25 |
LOGGER.info("Serial Number {} Date {}", serialNumber, date);
|
25 |
LOGGER.info("Serial Number {} Date {}", serialNumber, date);
|
| 26 |
activatedImeiRepository.saveActivation(serialNumber, date != null ? date.atStartOfDay() : null);
|
26 |
activatedImeiRepository.saveActivation(serialNumber, date != null ? date.atStartOfDay() : null);
|
| 27 |
});
|
27 |
});
|
| - |
|
28 |
restUnanswered(imeis, imeisDateMap);
|
| - |
|
29 |
}
|
| - |
|
30 |
|
| - |
|
31 |
/**
|
| - |
|
32 |
* Stamp the imeis that never reached an answer, so the chunk advances past them.
|
| - |
|
33 |
*
|
| - |
|
34 |
* checkWarranty already records a null date for a lookup the portal ANSWERED with no
|
| - |
|
35 |
* activation, so what is left here is genuine failure: an exception, a captcha never
|
| - |
|
36 |
* broken, a dead driver. Those wrote no row at all, which left createTimestamp
|
| - |
|
37 |
* untouched and the imei immediately due again.
|
| - |
|
38 |
*
|
| - |
|
39 |
* Under the old snapshotted once-a-day pass that was harmless -- the pass had already
|
| - |
|
40 |
* walked past them, so they came back tomorrow either way. Under a 20-second tick the
|
| - |
|
41 |
* pool query IS the cursor, so an unstamped imei is handed back twenty seconds later
|
| - |
|
42 |
* and the batch never advances. That is the 4.5-asks-per-imei runaway measured on
|
| - |
|
43 |
* 29-Aug, and at this cadence it is 15x tighter than the 5-minute version that caused it.
|
| - |
|
44 |
*
|
| - |
|
45 |
* saveActivation(serial, null) bumps createTimestamp without claiming a date, and it
|
| - |
|
46 |
* cannot erase one: the setter is only reached for a non-null timestamp. So a failure
|
| - |
|
47 |
* costs exactly one retry, tomorrow.
|
| - |
|
48 |
*/
|
| - |
|
49 |
private void restUnanswered(List<String> imeis, Map<String, LocalDate> answered) {
|
| - |
|
50 |
for (String serialNumber : imeis) {
|
| - |
|
51 |
if (!answered.containsKey(serialNumber)) {
|
| - |
|
52 |
LOGGER.info("Serial Number {} unanswered, resting until tomorrow", serialNumber);
|
| - |
|
53 |
activatedImeiRepository.saveActivation(serialNumber, null);
|
| - |
|
54 |
}
|
| - |
|
55 |
}
|
| 28 |
}
|
56 |
}
|
| 29 |
|
57 |
|
| 30 |
}
|
58 |
}
|