3
0
mirror of https://github.com/Qortal/qortal.git synced 2025-02-11 09:45:50 +00:00

added logging to help solve the updated field problem, the problem is the updated field is not getting updated

This commit is contained in:
kennycud 2024-12-10 14:07:11 -08:00
parent 08a2284ce4
commit 5346c97922

View File

@ -397,11 +397,14 @@ public class ArbitraryTransaction extends Transaction {
ArbitraryResourceData existingArbitraryResourceData = repository.getArbitraryRepository()
.getArbitraryResource(service, name, identifier);
LOGGER.info("updating existing arbitraryResourceData" + existingArbitraryResourceData);
// Check for existing cached data
if (existingArbitraryResourceData == null) {
// Nothing exists yet, so set creation date from the current transaction (it will be reduced later if needed)
arbitraryResourceData.created = arbitraryTransactionData.getTimestamp();
arbitraryResourceData.updated = null;
LOGGER.info("updated = null, reason = existingArbitraryResourceData == null" );
}
else {
// An entry already exists - update created time from current transaction if this is older
@ -411,14 +414,20 @@ public class ArbitraryTransaction extends Transaction {
if (existingArbitraryResourceData.created == latestTransactionData.getTimestamp()) {
// Latest transaction matches created time, so it hasn't been updated
arbitraryResourceData.updated = null;
LOGGER.info(
"updated = null, reason: existingArbitraryResourceData.created == latestTransactionData.getTimestamp() == " +
existingArbitraryResourceData.created );
}
else {
arbitraryResourceData.updated = latestTransactionData.getTimestamp();
LOGGER.info("setting updated to a non-null value");
}
}
arbitraryResourceData.size = latestTransactionData.getSize();
LOGGER.info("saving updated arbitraryResourceData: updated = " + arbitraryResourceData.updated);
// Save
repository.getArbitraryRepository().save(arbitraryResourceData);
}