Skip to content

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

Merged
merged 4 commits into from
Nov 20, 2023

Conversation

abb3r
Copy link

@abb3r abb3r commented Nov 17, 2023

No description provided.

Rahman Abber Tahir added 3 commits November 17, 2023 10:46
Copy link
Member

@rainerschoe rainerschoe left a 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 :)

Comment on lines 331 to 334
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 )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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 )

Copy link
Author

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)

Copy link
Author

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
Copy link
Member

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 :)

Copy link
Author

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]>
@abb3r
Copy link
Author

abb3r commented Nov 20, 2023

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 :)

Thanks for reviews :) added some comments/styling as suggested, pls have a look.

Copy link
Member

@rainerschoe rainerschoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!!!

@rainerschoe rainerschoe merged commit e3d3f6c into IBM:master Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants