http-service: increase loot tracker retention to 90 days

This commit is contained in:
Adam
2020-08-22 11:09:07 -04:00
parent 2f2da2c1dc
commit 9c81e9b509
2 changed files with 11 additions and 3 deletions

View File

@@ -33,6 +33,7 @@ import net.runelite.http.api.loottracker.LootAggregate;
import net.runelite.http.api.loottracker.LootRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.sql2o.Connection;
@@ -75,11 +76,16 @@ public class LootTrackerService
private static final String DELETE_LOOT_ACCOUNT_EVENTID = "DELETE FROM loottracker_kills WHERE accountId = :accountId AND eventId = :eventId";
private final Sql2o sql2o;
private final int historyDays;
@Autowired
public LootTrackerService(@Qualifier("Runelite SQL2O") Sql2o sql2o)
public LootTrackerService(
@Qualifier("Runelite SQL2O") Sql2o sql2o,
@Value("${runelite.loottracker.history}") int historyDays
)
{
this.sql2o = sql2o;
this.historyDays = historyDays;
// Ensure necessary tables exist
try (Connection con = sql2o.open())
@@ -197,7 +203,7 @@ public class LootTrackerService
{
try (Connection con = sql2o.open())
{
con.createQuery("delete from loottracker_kills where last_time < current_timestamp() - interval 30 day")
con.createQuery("delete from loottracker_kills where last_time < current_timestamp() - interval " + historyDays + " day")
.executeUpdate();
}
}

View File

@@ -34,11 +34,13 @@ mongo:
jndiName: java:comp/env/mongodb/runelite
database: runelite
# Twitter client for feed
runelite:
# Twitter client for feed
twitter:
consumerkey:
secretkey:
listid: 1185897074786742273
ge:
history: 90 # days
loottracker:
history: 90 # days