mirror of
https://github.com/immich-app/immich.git
synced 2026-01-18 10:00:41 -05:00
21 lines
594 B
Dart
21 lines
594 B
Dart
// ignore_for_file: avoid-passing-async-when-sync-expected
|
|
|
|
import 'dart:async';
|
|
|
|
import 'package:async/async.dart';
|
|
import 'package:immich_mobile/providers/infrastructure/sync_stream.provider.dart';
|
|
import 'package:immich_mobile/utils/isolate.dart';
|
|
|
|
class BackgroundSyncManager {
|
|
// This prevents multiple syncs from running at the same time
|
|
final _userSyncCache = AsyncCache.ephemeral();
|
|
|
|
BackgroundSyncManager();
|
|
|
|
Future<void> syncUsers() => _userSyncCache.fetch(
|
|
() => runInIsolate(
|
|
(ref) => ref.read(syncStreamServiceProvider).syncUsers(),
|
|
),
|
|
);
|
|
}
|