Fix updates timer should only be configured once per profile and do nothing if not the active one

This commit is contained in:
Hank Grabowski 2023-05-09 16:42:36 -04:00
parent e5f06f650a
commit fbf95350e4

View file

@ -29,11 +29,15 @@ Future<void> executeUpdatesForProfile(Profile profile) async {
return;
}
if (getIt<AccountsService>().currentProfile != profile) {
return;
}
await getIt<ActiveProfileSelector<PersistentInfoService>>()
.getForProfile(profile)
.withResultAsync((info) async {
final dt = DateTime.now().difference(info.lastMyConnectionsUpdate);
_logger.finer('Time since last connections update: $dt');
_logger.finer('Time since last update for ${profile.id}: $dt');
if (dt >= _connectionsRefreshInterval) {
await getIt<ActiveProfileSelector<ConnectionsManager>>()
.getForProfile(profile)