Subversion Repositories SmartDukaan

Rev

Rev 37448 | Rev 37472 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 37448 Rev 37459
Line 19... Line 19...
19
 
19
 
20
	@Autowired
20
	@Autowired
21
	private RealmeImeiActivationService realmeImeiActivationService;
21
	private RealmeImeiActivationService realmeImeiActivationService;
22
 
22
 
23
	@Autowired
23
	@Autowired
-
 
24
	private MotorolaImeiActivationService motorolaImeiActivationService;
-
 
25
 
-
 
26
	@Autowired
24
	private ActivatedImeiRepository activatedImeiRepository;
27
	private ActivatedImeiRepository activatedImeiRepository;
25
 
28
 
26
	private static final Logger LOGGER = LogManager.getLogger(StandAlone.class);
29
	private static final Logger LOGGER = LogManager.getLogger(StandAlone.class);
27
 
30
 
28
	public void checkOppoImeiStatus() throws Exception {
31
	public void checkOppoImeiStatus() throws Exception {
Line 116... Line 119...
116
			return;
119
			return;
117
		}
120
		}
118
		realmeImeiActivationService.updateActivationDate(all);
121
		realmeImeiActivationService.updateActivationDate(all);
119
	}
122
	}
120
 
123
 
-
 
124
	/**
-
 
125
	 * Motorola: secondary + tertiary in ONE browser session, same shape as the
-
 
126
	 * oppo/realme combined jobs.
-
 
127
	 *
-
 
128
	 * Cadence: the pool query defers an imei for `days` after each attempt
-
 
129
	 * (saveActivation bumps createTimestamp even when no date came back), so
-
 
130
	 * days=2 gives the requested "retry everything every two days".
-
 
131
	 *
-
 
132
	 * Sizing: the pending pool measured 1,534 (1,182 secondary + 352 tertiary).
-
 
133
	 * At the ~10-14s/imei the oppo and realme jobs measure, 60 per invocation is
-
 
134
	 * roughly 12 minutes of driver time, and clearing 1,534 inside 48h needs
-
 
135
	 * about 26 invocations -- i.e. an OS cron entry every 90 minutes, with
-
 
136
	 * headroom. Do NOT schedule it inside the oppo/realme window: each driver
-
 
137
	 * tree costs ~850MB and this box has been OOM-killed twice with tomcat the
-
 
138
	 * victim, so peak concurrent drivers is the number that matters.
-
 
139
	 */
-
 
140
	public void checkMotorolaImeiStatusCombined() throws Exception {
-
 
141
		List<String> secondary = activatedImeiRepository.selectImeiActivationPendingByBrand("Motorola", 2, 30)
-
 
142
				.stream().map(ImeiActivationTimestampModel::getSerialNumber).collect(Collectors.toList());
-
 
143
		List<String> tertiary = activatedImeiRepository.selectImeiActivationPendingByBrandTertiary("Motorola", 2, 30)
-
 
144
				.stream().map(ImeiActivationTimestampModel::getSerialNumber).collect(Collectors.toList());
-
 
145
		LOGGER.info("Motorola secondary imeis {}", secondary);
-
 
146
		LOGGER.info("Motorola tertiary imeis {}", tertiary);
-
 
147
		List<String> all = new ArrayList<>(secondary);
-
 
148
		all.addAll(tertiary);
-
 
149
		all = all.stream().distinct().collect(Collectors.toList());
-
 
150
		if (all.isEmpty()) {
-
 
151
			LOGGER.info("Motorola: nothing pending, not starting a browser");
-
 
152
			return;
-
 
153
		}
-
 
154
		motorolaImeiActivationService.updateActivationDate(all);
-
 
155
	}
-
 
156
 
121
}
157
}