Cache updating moved back to existing threads when processing or importing a transaction, to remove chances of queued updates being lost.

The dedicated cache manager thread is now used for metadata updates only. If metadata ever goes missing from the db, it would be straightforward to have a background thread that corrects any discrepancies between the filesystem and the db. Not adding that until it is needed.
This commit is contained in:
CalDescent 2023-05-13 15:11:32 +01:00
parent f451bccbf6
commit a49529ad9b

View File

@ -250,17 +250,8 @@ public class ArbitraryTransaction extends Transaction {
// We may need to move files from the misc_ folder
ArbitraryTransactionUtils.checkAndRelocateMiscFiles(arbitraryTransactionData);
// If the data is local, we need to perform a few actions
if (isDataLocal()) {
// We have the data for this transaction, so invalidate the cache
if (arbitraryTransactionData.getName() != null) {
ArbitraryDataManager.getInstance().invalidateCache(arbitraryTransactionData);
}
}
// Add to queue for cache updates
ArbitraryDataCacheManager.getInstance().addToUpdateQueue(arbitraryTransactionData);
// Update caches
updateCaches();
}
@Override
@ -296,8 +287,9 @@ public class ArbitraryTransaction extends Transaction {
}
}
// Add to queue for cache updates
ArbitraryDataCacheManager.getInstance().addToUpdateQueue(arbitraryTransactionData);
// Add/update arbitrary resource caches
this.updateArbitraryResourceCache();
this.updateArbitraryMetadataCache();
} catch (Exception e) {
// Log and ignore all exceptions. The cache is updated from other places too, and can be rebuilt if needed.