-
Notifications
You must be signed in to change notification settings - Fork 15
retry parsing after removing the cache file. #148
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
Conversation
Signed-off-by: Rahman Abber Tahir <[email protected]>
Signed-off-by: Rahman Abber Tahir <[email protected]>
Signed-off-by: Rahman Abber Tahir <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot. This makes gwhisper much more resilient :)
Please have a look at the suggestions (just comments, docs and style) then we can merge :)
localDescDb::DescriptorDb newDbFile; //new file to ensure there are no side-effects from last parsing failure. | ||
std::filesystem::remove(cacheFilePath); //remove cache file if failed and try again. | ||
|
||
if( getDbFileFromCacheFile(cacheFilePath, newDbFile) == false ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
localDescDb::DescriptorDb newDbFile; //new file to ensure there are no side-effects from last parsing failure. | |
std::filesystem::remove(cacheFilePath); //remove cache file if failed and try again. | |
if( getDbFileFromCacheFile(cacheFilePath, newDbFile) == false ) | |
// Parsing the cache file failed. re-instantiating the cache: | |
// remove cache file if failed and try again. | |
std::filesystem::remove(cacheFilePath); | |
// new file to ensure there are no side-effects from last parsing failure. | |
localDescDb::DescriptorDb newDbFile; | |
if( getDbFileFromCacheFile(cacheFilePath, newDbFile) == false ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah the comments and arrangment... done
{ | ||
std::string cacheFilePath = prepareCacheFile(); | ||
|
||
static bool getDbFileFromCacheFile(const std::string& cacheFilePath, localDescDb::DescriptorDb& file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static bool getDbFileFromCacheFile(const std::string& cacheFilePath, localDescDb::DescriptorDb& file) | |
/// returns false if file was found but could not be parsed. true otherwise. | |
static bool getDbFileFromCacheFile(const std::string& cacheFilePath, localDescDb::DescriptorDb& file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -42,6 +42,28 @@ RPC succeeded :D | |||
#END_CMD | |||
#END_TEST | |||
|
|||
#START_TEST RPC with invalid cache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this test :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are welcome!
Signed-off-by: Rahman Abber Tahir <[email protected]>
Thanks for reviews :) added some comments/styling as suggested, pls have a look. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks!!!
No description provided.