|
49 | 49 | def _retry_on_404(func: Callable[P, T]) -> Callable[P, T]:
|
50 | 50 | @wraps(func)
|
51 | 51 | def retrying_func(*args: P.args, **kwargs: P.kwargs) -> T:
|
52 |
| - for wait_time in [0, 10, 100]: |
| 52 | + for wait_time in [0, 10, 20, 100]: |
53 | 53 | time.sleep(wait_time) # if we start monitoring too soon we might hit a 404
|
54 | 54 | try:
|
55 | 55 | return func(*args, **kwargs)
|
@@ -178,6 +178,7 @@ def run_procedure(self) -> tuple[list[str], list[str]]:
|
178 | 178 | batch_request = self._create_or_collect_batch_request()
|
179 | 179 |
|
180 | 180 | user_action = self._trigger_user_action(batch_request)
|
| 181 | + self._wait_for_sh_db_sync(batch_request) |
181 | 182 |
|
182 | 183 | if user_action is BatchUserAction.ANALYSE or (
|
183 | 184 | user_action is BatchUserAction.START and batch_request.status is not BatchRequestStatus.ANALYSIS_DONE
|
@@ -308,6 +309,11 @@ def _trigger_user_action(self, batch_request: BatchRequest) -> BatchUserAction:
|
308 | 309 | LOGGER.info("Didn't trigger batch job because current batch request status is %s", status)
|
309 | 310 | return BatchUserAction.NONE
|
310 | 311 |
|
| 312 | + @_retry_on_404 |
| 313 | + def _wait_for_sh_db_sync(self, batch_request: BatchRequest) -> None: |
| 314 | + """Wait for SH read/write databases to sync.""" |
| 315 | + self.batch_client.get_request(batch_request) |
| 316 | + |
311 | 317 | def cache_batch_area_manager_grid(self, request_id: str) -> None:
|
312 | 318 | """This method ensures that area manager caches batch grid into the storage."""
|
313 | 319 | if self.area_manager.config.batch_id and self.area_manager.config.batch_id != request_id:
|
|
0 commit comments