TDB2: Explicitly mark updates done as addition to optimize performance
We are able to avoid loading the completed.data in certain scenarios.
This commit is contained in:
committed by
Paul Beckingham
parent
48be6986c2
commit
f0cc0151b7
@@ -572,7 +572,7 @@ void TDB2::add (Task& task, bool add_to_backlog /* = true */)
|
||||
if (add_to_backlog)
|
||||
context.hooks.onAdd (task);
|
||||
|
||||
update (uuid, task, add_to_backlog);
|
||||
update (uuid, task, add_to_backlog, true);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -598,14 +598,15 @@ void TDB2::modify (Task& task, bool add_to_backlog /* = true */)
|
||||
void TDB2::update (
|
||||
const std::string& uuid,
|
||||
Task& task,
|
||||
const bool add_to_backlog)
|
||||
const bool add_to_backlog,
|
||||
const bool addition)
|
||||
{
|
||||
// Validate to add metadata.
|
||||
task.validate (false);
|
||||
|
||||
// If the task already exists, it is a modification, else addition.
|
||||
Task original;
|
||||
if (get (task.get ("uuid"), original))
|
||||
if (not addition && get (task.get ("uuid"), original))
|
||||
{
|
||||
// Update the task, wherever it is.
|
||||
if (!pending.modify_task (task))
|
||||
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
|
||||
private:
|
||||
void gather_changes ();
|
||||
void update (const std::string&, Task&, const bool);
|
||||
void update (const std::string&, Task&, const bool, const bool addition = false);
|
||||
bool verifyUniqueUUID (const std::string&);
|
||||
void show_diff (const std::string&, const std::string&, const std::string&);
|
||||
void revert_undo (std::vector <std::string>&, std::string&, std::string&, std::string&, std::string&);
|
||||
|
||||
Reference in New Issue
Block a user