Bug #1022
- Fixed bug #1022, where dependencies were note released when a blocking task was completed (thanks to Arkady Grudzinsky). - The Task object now caches ::is_blocked and ::is_blocking Booleans that are determined on pending.data load. - Simplified and sped up color rule processing using cached values, reducing the number of map lookups, and removed loop invariants when the rules are not defined. - Simplified urgency calculations given the cached values for blocked/blocking. - On load, pending.data is scanned for accurate blocked/blocking status determination. - Obsoleted and removed complex single-task dependency calculations. - Sped up 'nag' processing by using cached values.. - Modified the 'show' command to consider color.blocking to be valid. - Added default config value for color.blocking, and included it in the precedence list ahead of blocked, as it is more important. - Updated taskrc.5 man page to include the new color.blocking rule, and its place in the rule precedence.
This commit is contained in:
24
src/Task.cpp
24
src/Task.cpp
@@ -100,6 +100,8 @@ Task::Task ()
|
||||
: id (0)
|
||||
, urgency_value (0.0)
|
||||
, recalc_urgency (true)
|
||||
, is_blocked (false)
|
||||
, is_blocking (false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -119,6 +121,8 @@ Task& Task::operator= (const Task& other)
|
||||
id = other.id;
|
||||
urgency_value = other.urgency_value;
|
||||
recalc_urgency = other.recalc_urgency;
|
||||
is_blocked = other.is_blocked;
|
||||
is_blocking = other.is_blocking;
|
||||
}
|
||||
|
||||
return *this;
|
||||
@@ -1409,22 +1413,8 @@ float Task::urgency_waiting () const
|
||||
// A task is blocked only if the task it depends upon is pending/waiting.
|
||||
float Task::urgency_blocked () const
|
||||
{
|
||||
if (has ("depends"))
|
||||
{
|
||||
std::vector <std::string> deps;
|
||||
getDependencies (deps);
|
||||
|
||||
std::vector <std::string>::iterator d;
|
||||
for (d = deps.begin (); d != deps.end (); ++d)
|
||||
{
|
||||
Task t;
|
||||
if (context.tdb2.get (*d, t) &&
|
||||
(t.getStatus () == Task::pending || t.getStatus () == Task::waiting))
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_blocked)
|
||||
return 1.0;
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
@@ -1524,7 +1514,7 @@ float Task::urgency_age () const
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
float Task::urgency_blocking () const
|
||||
{
|
||||
if (dependencyIsBlocking (*this))
|
||||
if (is_blocking)
|
||||
return 1.0;
|
||||
|
||||
return 0.0;
|
||||
|
||||
Reference in New Issue
Block a user