hotfix added endpoint to restart zip all files for saas migration

This commit is contained in:
Dominique Eifländer 2024-04-18 09:47:47 +02:00
parent c636a67277
commit ba82b94db0
3 changed files with 25 additions and 0 deletions

View File

@ -99,6 +99,12 @@ public class MigrationStatusController implements MigrationStatusResource {
}
public void retryZipFiles(){
saasMigrationService.restartZipFiles();
}
private static boolean migrationIsFinished(MigrationStatusResponse migrationStatus) {
return migrationStatus.getFilesInStatus().entrySet().stream().filter(e -> e.getValue() > 0).allMatch(e -> e.getKey().equals(FINISHED) || e.getKey().equals(ERROR));

View File

@ -17,6 +17,8 @@ public interface MigrationStatusResource {
String REVERT_MIGRATION_REST_PATH = ExternalApi.BASE_PATH + "/revert_migration";
String RETRY_MIGRATION_REST_PATH = ExternalApi.BASE_PATH + "/retry_migration";
String RETRY_ZIP_FILES_REST_PATH = ExternalApi.BASE_PATH + "/retry_zip_files";
String FILE_ID = "fileId";
String FILE_ID_PATH_VARIABLE = "/{" + FILE_ID + "}";
@ -48,6 +50,13 @@ public interface MigrationStatusResource {
ResponseEntity<?> requeueErrorFiles();
@ResponseBody
@PostMapping(value = RETRY_ZIP_FILES_REST_PATH)
@Operation(summary = "Restart zip all files in storage that are not zipped", description = "None")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Success.")})
void retryZipFiles();
}

View File

@ -9,6 +9,7 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.iqser.red.service.persistence.management.v1.processor.entity.annotations.AnnotationEntityId;
@ -133,6 +134,7 @@ public class SaasMigrationService implements TenantSyncService {
}
@Async
public void requeueErrorFiles() {
automaticAnalysisJob.stopForTenant(TenantContext.getTenantId());
@ -142,6 +144,14 @@ public class SaasMigrationService implements TenantSyncService {
}
@Async
public void restartZipFiles(){
log.info("Starting uncompressed files migration ...");
uncompressedFilesMigrationService.migrateUncompressedFiles(TenantContext.getTenantId());
log.info("Finished uncompressed files migration ...");
}
public void handleLayoutParsingFinished(String dossierId, String fileId) {
if (!layoutParsingFilesExist(dossierId, fileId)) {