RideCache - send less load update notifications

To minimize overhead and avoid crashes on Windows
Fixes #4471
This commit is contained in:
Alejandro Martinez
2024-04-10 19:27:49 -03:00
parent a1a19d86a0
commit 3b50dd81a9

View File

@@ -82,8 +82,12 @@ ride: '{' rideelement_list '}' {
jc->api->writeRideLine(jc->item, jc->request, jc->response);
#endif
} else {
double progress= double(jc->loading++) / double(jc->cache->rides().count()) * 100.0f;
jc->context->notifyLoadProgress(jc->folder,progress);
static double last = 0.0;
double progress= round(double(jc->loading++) / double(jc->cache->rides().count()) * 100.0f);
if (progress > last) {
jc->context->notifyLoadProgress(jc->folder,progress);
last = progress;
}
// find entry and update it
int index=jc->cache->find(&jc->item);