Skip to content

Commit

Permalink
fix. fjernet processing status for arena hendelser
Browse files Browse the repository at this point in the history
* Ingen behov for statusen når vi kjører leader pod
det skapte bare støy i tilfelle en hendelse satt seg fast
pga flaskehalser i databasen ved stor last som gjorde at
manuell oppdatering måtte til.
  • Loading branch information
eirikv committed Dec 5, 2024
1 parent 26e18af commit 79686a9
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

public enum ArenaEventStatus {
CREATED,
PROCESSING,
DONE,
IGNORED,
FAILED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

import lombok.extern.slf4j.Slf4j;
import no.nav.tag.tiltaksgjennomforing.arena.models.migration.ArenaAgreementAggregate;
import no.nav.tag.tiltaksgjennomforing.arena.models.migration.ArenaAgreementMigration;
import no.nav.tag.tiltaksgjennomforing.arena.models.migration.ArenaAgreementMigrationStatus;
import no.nav.tag.tiltaksgjennomforing.arena.repository.ArenaAgreementMigrationRepository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
Expand All @@ -26,25 +22,8 @@ public ArenaAgreementService(
this.arenaAgreementMigrationRepository = arenaAgreementMigrationRepository;
}

@Transactional
public List<ArenaAgreementAggregate> getArenaAgreementsForProcessing() {
List<ArenaAgreementAggregate> agreementAggregates = arenaAgreementMigrationRepository.findMigrationAgreementAggregates();

arenaAgreementMigrationRepository.saveAll(
arenaAgreementMigrationRepository
.findMigrationAgreementAggregates()
.stream()
.map(aggregate ->
ArenaAgreementMigration.builder()
.tiltakgjennomforingId(aggregate.getTiltakgjennomforingId())
.status(ArenaAgreementMigrationStatus.PROCESSING)
.modified(LocalDateTime.now())
.build()
)
.toList()
);

return agreementAggregates;
return arenaAgreementMigrationRepository.findMigrationAgreementAggregates();
}

public void processAgreements(List<ArenaAgreementAggregate> agreements) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public List<ArenaEvent> getAndUpdateEvents() {
.map(arenaEvent ->
isMaxRetry(arenaEvent)
? arenaEvent.toBuilder().status(ArenaEventStatus.FAILED).build()
: arenaEvent.toBuilder().status(ArenaEventStatus.PROCESSING).retryCount(arenaEvent.getRetryCount() + 1).build()
: arenaEvent.toBuilder().retryCount(arenaEvent.getRetryCount() + 1).build()
)
.toList();

Expand Down

0 comments on commit 79686a9

Please sign in to comment.