Skip to content

Commit 3c83a67

Browse files
Fix Python plugin project reparse
Currently, if we try to reparse a Python project, the CodeCompass_parser exits with the following error: "terminate called after throwing an instance of 'odb::object_already_persistent'". As a fix, we perform a database cleanup in case of incremental parsing. Note: incremental parsing is not intended to work this way and should be implemented correctly in the future.
1 parent 3755e3f commit 3c83a67

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

plugins/python/parser/src/pythonparser.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ void PythonParser::parseProject(const std::string& root_path)
8888
{
8989
for(const auto& e : map)
9090
{
91+
if (_ctx.db->query_one<model::PYName>(odb::query<model::PYName>::id == e.first))
92+
{
93+
_ctx.db->erase(e.second);
94+
}
95+
9196
_ctx.db->persist(e.second);
9297
}
9398
});

0 commit comments

Comments
 (0)