Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17

- name: Checkout sources
uses: actions/checkout@v1
Expand Down
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<parent>
<groupId>com.powsybl</groupId>
<artifactId>powsybl-parent-ws</artifactId>
<version>10</version>
<version>11</version>
<relativePath/>
</parent>

Expand Down Expand Up @@ -44,7 +44,6 @@
</developers>

<properties>
<java.version>11</java.version>
<gridsuite-dependencies.version>23</gridsuite-dependencies.version>
<liquibase-hibernate-package>org.gridsuite.useradmin.server</liquibase-hibernate-package>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Map;
import java.util.Objects;
Expand All @@ -33,10 +34,11 @@ public ConnectionsService(ConnectionRepository connectionRepository) {
public void recordConnectionAttempt(String sub, Boolean isAllowed) {
ConnectionEntity connectionEntity = connectionRepository.findBySub(sub).stream().findFirst().orElse(null);
if (connectionEntity == null) {
connectionEntity = new ConnectionEntity(sub, LocalDateTime.now(), LocalDateTime.now(), isAllowed);
//To avoid consistency issue we truncate the time to microseconds since postgres and h2 can only store a precision of microseconds
connectionEntity = new ConnectionEntity(sub, LocalDateTime.now().truncatedTo(ChronoUnit.MICROS), LocalDateTime.now().truncatedTo(ChronoUnit.MICROS), isAllowed);
connectionRepository.save(connectionEntity);
} else {
connectionEntity.setLastConnexionDate(LocalDateTime.now());
connectionEntity.setLastConnexionDate(LocalDateTime.now().truncatedTo(ChronoUnit.MICROS));
connectionEntity.setConnectionAccepted(isAllowed);
}
}
Expand Down