Estimator lazy refresh

.. Refresh model estimates when rides added, deleted, saved.

.. Lazy refresh will cancel any pending or running threads and
   trigger a new one in 15 secs time.

.. This strategy allows us to call a lazy refresh even when importing
   large number of rides, since the start will be delayed and cancelled
   by the next ride added etc.

.. The thread stop() function is also called by the destructor to stop
   when the user exits and avoiding delay/SEGV on exit.
This commit is contained in:
Mark Liversedge
2018-04-01 14:46:30 +01:00
parent 6e6db666c5
commit f8af6334fb
5 changed files with 73 additions and 3 deletions

View File

@@ -287,6 +287,9 @@ RideCache::addRide(QString name, bool dosignal, bool select, bool useTempActivit
// notify everyone to select the one we were already on
context->notifyRideSelected(prior);
}
// model estimates (lazy refresh)
estimator->refresh();
}
void
@@ -376,6 +379,9 @@ RideCache::removeCurrentRide()
// now select another ride
context->notifyRideSelected(select);
// model estimates (lazy refresh)
estimator->refresh();
}
// NOTE: