Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
victoriaum committed Feb 6, 2023
1 parent 309a00e commit 60b5108
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
Expand Down Expand Up @@ -195,16 +195,17 @@
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.8.1</version>
<version>3.0.0</version>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
<dependencyDetailsEnabled>false</dependencyDetailsEnabled>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<version>3.4.1</version>
</plugin>
</plugins>
</reporting>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ private void updateBasic(Jedis jedis, String key, MeterReading reading) {
// Challenge #3
private void updateOptimized(Jedis jedis, String key, MeterReading reading) {
// START Challenge #3
try (Transaction t = jedis.multi()) {
String reportingTime = ZonedDateTime.now(ZoneOffset.UTC).toString();
t.hset(key, SiteStats.reportingTimeField, reportingTime);
t.hincrBy(key, SiteStats.countField, 1);
t.expire(key, weekSeconds);
this.compareAndUpdateScript.updateIfGreater(t, key, SiteStats.maxWhField,
reading.getWhGenerated());
this.compareAndUpdateScript.updateIfLess(t, key, SiteStats.minWhField,
reading.getWhGenerated());
this.compareAndUpdateScript.updateIfGreater(t, key, SiteStats.maxCapacityField,
getCurrentCapacity(reading));

t.exec();
}
// END Challenge #3
}

Expand Down

0 comments on commit 60b5108

Please sign in to comment.