mirror of
https://github.com/immich-app/immich.git
synced 2025-08-11 09:16:31 -04:00
feat: use the truncate limit from constants.ts as default
This commit is contained in:
parent
0825d9a94c
commit
547380c410
@ -1,4 +1,5 @@
|
|||||||
import 'package:drift/drift.dart';
|
import 'package:drift/drift.dart';
|
||||||
|
import 'package:immich_mobile/constants/constants.dart';
|
||||||
import 'package:immich_mobile/domain/models/log.model.dart';
|
import 'package:immich_mobile/domain/models/log.model.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/log.entity.dart';
|
import 'package:immich_mobile/infrastructure/entities/log.entity.dart';
|
||||||
import 'package:immich_mobile/infrastructure/entities/log.entity.drift.dart';
|
import 'package:immich_mobile/infrastructure/entities/log.entity.drift.dart';
|
||||||
@ -77,7 +78,7 @@ class LogRepository extends DriftLoggerDatabaseRepository {
|
|||||||
return query.watch().map((rows) => rows.map((row) => row.toDto()).toList());
|
return query.watch().map((rows) => rows.map((row) => row.toDto()).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> truncate({int limit = 2000}) async {
|
Future<void> truncate({int limit = kLogTruncateLimit}) async {
|
||||||
final totalCount = await _db.managers.logMessageEntity.count();
|
final totalCount = await _db.managers.logMessageEntity.count();
|
||||||
if (totalCount > limit) {
|
if (totalCount > limit) {
|
||||||
final rowsToDelete = totalCount - limit;
|
final rowsToDelete = totalCount - limit;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user