mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
Invalidation on logout and timing measurements
This commit is contained in:
parent
894eea739e
commit
75d8ca1306
3 changed files with 22 additions and 1 deletions
|
|
@ -21,15 +21,28 @@ class AssetNotifier extends StateNotifier<List<AssetResponseDto>> {
|
|||
}
|
||||
|
||||
getAllAsset() async {
|
||||
final stopwatch = Stopwatch();
|
||||
|
||||
|
||||
if (_assetCacheService.isValid() && state.isEmpty) {
|
||||
stopwatch.start();
|
||||
state = await _assetCacheService.getAssetsAsync();
|
||||
debugPrint("Reading assets from cache: ${stopwatch.elapsedMilliseconds}ms");
|
||||
stopwatch.reset();
|
||||
}
|
||||
|
||||
stopwatch.start();
|
||||
var allAssets = await _assetService.getAllAsset();
|
||||
debugPrint("Query assets from API: ${stopwatch.elapsedMilliseconds}ms");
|
||||
stopwatch.reset();
|
||||
|
||||
if (allAssets != null) {
|
||||
state = allAssets;
|
||||
|
||||
stopwatch.start();
|
||||
_cacheState();
|
||||
debugPrint("Store assets in cache: ${stopwatch.elapsedMilliseconds}ms");
|
||||
stopwatch.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue