Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ripper2hl committed Apr 13, 2024
2 parents 4e8d7c3 + 649c07d commit a21268e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 24 deletions.
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM maven:3.6.3-openjdk-16-slim AS build
FROM maven:3-eclipse-temurin-21 AS build
ADD src /usr/src/app/src
ADD pom.xml /usr/src/app/
RUN mvn -f /usr/src/app/pom.xml clean package -Dmaven.test.skip=true
RUN mv /usr/src/app/target/*.jar /usr/src/app/target/app.jar

FROM adoptopenjdk/openjdk16-openj9:x86_64-alpine-jre-16_36_openj9-0.25.0
FROM eclipse-temurin:21-alpine
RUN mkdir /sepomex-indices/
COPY --from=build /usr/src/app/target/app.jar /
ENTRYPOINT java -XX:MaxMetaspaceSize=64m -XX:CompressedClassSpaceSize=8m -Xss256k -Xmn8m -XX:InitialCodeCacheSize=4m -XX:ReservedCodeCacheSize=8m -XX:MaxDirectMemorySize=16m -XX:NativeMemoryTracking=summary -XX:+UnlockDiagnosticVMOptions -XX:+PrintNMTStatistics -Xshareclasses:cacheDir=/tmp,noPersistentDiskSpaceCheck -Xquickstart -XX:+UseContainerSupport -jar /app.jar
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
<version>1.5</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
<version>2.16.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/perales/sepomex/service/ArchivoService.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,19 @@ public void indexDb() throws InterruptedException {

public Boolean cargaMasiva(MultipartFile file) throws IOException {
EntityManager em = emf.createEntityManager();
AtomicInteger coloniasProcesadas = new AtomicInteger(0);
try (BufferedReader br = new BufferedReader( new InputStreamReader( file.getInputStream() , "UTF-8") )) {
List<Colonia> colonias = leerColoniaDesdeArchivo(br);
int totalColonias = colonias.size();

Iterables.partition(colonias, 10000).forEach(coloniasBatch -> {
em.getTransaction().begin();
for(Colonia colonia : coloniasBatch){
try {
revisarColonia(colonia, em);
coloniasProcesadas.incrementAndGet();
double porcentaje = ((double) coloniasProcesadas.get() / totalColonias) * 100;
log.info("Porcentaje de colonias procesadas: " + porcentaje + "%");
}catch (Exception e){
e.printStackTrace();
}
Expand Down

0 comments on commit a21268e

Please sign in to comment.