NoteRename: Do it before trying to get the lock

Another operation coule be blocking git.
This commit is contained in:
Vishesh Handa
2020-06-10 15:16:22 +02:00
parent ae74e02fa7
commit c98d01415f

View File

@ -204,12 +204,12 @@ class StateContainer with ChangeNotifier {
void renameNote(Note note, String newFileName) async {
logEvent(Event.NoteRenamed);
var oldNotePath = note.filePath;
note.rename(newFileName);
return _opLock.synchronized(() async {
Log.d("Got renameNote lock");
var oldNotePath = note.filePath;
note.rename(newFileName);
_gitRepo.renameNote(oldNotePath, note.filePath).then((NoteRepoResult _) {
_syncNotes();
appState.numChanges += 1;