Fix: Run single instance of offline import
This commit is contained in:
parent
9f270cf471
commit
1d960fadce
1 changed files with 8 additions and 0 deletions
|
@ -90,7 +90,13 @@ class CodeStore {
|
|||
Bus.instance.fire(CodesUpdatedEvent());
|
||||
}
|
||||
|
||||
bool _isOfflineImportRunning = false;
|
||||
|
||||
Future<void> importOfflineCodes() async {
|
||||
if(_isOfflineImportRunning) {
|
||||
return;
|
||||
}
|
||||
_isOfflineImportRunning = true;
|
||||
Logger logger = Logger('importOfflineCodes');
|
||||
try {
|
||||
Configuration config = Configuration.instance;
|
||||
|
@ -146,6 +152,8 @@ class CodeStore {
|
|||
AuthenticatorService.instance.onlineSync().ignore();
|
||||
} catch (e, s) {
|
||||
_logger.severe("error while importing offline codes", e, s);
|
||||
} finally {
|
||||
_isOfflineImportRunning = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue