-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emergency sync override switch #197
Comments
I'll try to give you some hints but it would take me some time to solidify them in my mind and to write them down. |
Ok, here are some of my thoughts:
It seems to be from looking at the sync algorithm's source code that this measure i.e. clearing the dirty flag, should cause the locally modified object be overridden by the remote object during sync. However, it would only be the case if the remote object was updated i.e. Evernote decided to actually send us this object during the sync. I was thinking about another kind of troubleshooting tool - like "reset the note/notebook/tag/saved search to its current state from Evernote", without any actual sync. However, this might bring in even more problems if we are not careful: for example, newest version of note from Evernote might contain linkage to tags which have not yet been synced to our account. So perhaps these need to be removed. Furthermore, the new version of note can be moved to a notebook which we haven't synced yet. So we need to stick the note within its old notebook (which our version thinks is the note's notebook is) and so on. It appears there can be a lot of cases in which we can screw up the integrity of the account's data in an unrecoverable way so let's not do this for now. Let me know if you'd need any further guidance. |
OK I can implement the version with setting dirty to false and I'll adjust the tests.
Yes. I agree. And for beginning the simple version should be sufficient. |
I started with this... seems to work as expected (also the test fails as expected (great!)). With current style the context menu callback looks like this: It is OK to refactor to a "less WET" version? |
I guess it is ok to refactor this kind of repeated code but I'd propose to do it a little differently, somewhat like this:
You might argue that these unlikely
If you want to go further, you can simplify these macros with further macros:
However, overuse of macros leads to poorly readable code and sometimes to problems with debugging. So I don't really encourage you to go that deep. There are some snippets like this in the gory guts of libquentier's local storage database handling but I am not proud of these at all. I don't quite see how would your current proposal deal with any condition which in my N times repeated code leads to returning from the method. You could probably throw an exception if anything goes wrong (I can sense it seems convenient to you from your Java experience) but in Qt using exceptions is generally a bad idea - any uncaught exceptions go to One other thing: Qt generally discourages the use of |
OK, I will read the Qt article you referenced and I will someway handle undefined values (I indented to do it anyway, the proposal was just quick draft version - I forgot there to check the values - you are correct). And I will someways apply your suggestion; I agree with not overusing macros. I'll send you some preview version in next day. :) I know how exceptions work in Java, but have only vague info about exceptions in C++; so I read that reference also. ok. thx |
One adjustment to my suggestion: ideally I'd like
but it would once again defeat the purpose of code duplication prevention - this ugly fragment with
but I'd like
|
OK agree. |
Refactoring in NoteListView, preparation for #197
Currently if the sync fails for what ever reason, even if I know, which note if "offending" there is no workaround for user.I just can't sync and this make the app unusable.
Suggestion: add "Developer mode switch" in Preferences.
This would enable context menu option "Clear dirty flag". Maybe with some warnings etc..
..if you give me some hints how to do it, I can try to implement
example from #196
2018-07-21 13:18:02.415 CEST libquentier/src/synchronization/SynchronizationManager_p.cpp @ 711 [Debug]: SynchronizationManagerPrivate::onSendLocalChangesFailure: Failed to send new and/or modified saved searches to Evernote service, BAD_DATA_FORMAT exception during the attempt to create a saved search, saved search has no query
The text was updated successfully, but these errors were encountered: