Merge lp:~boiko/calls-scope/fix_event_processing into lp:calls-scope

Proposed by Gustavo Pichorim Boiko
Status: Rejected
Rejected by: Kyle Nitzsche
Proposed branch: lp:~boiko/calls-scope/fix_event_processing
Merge into: lp:calls-scope
Diff against target: 12 lines (+1/-1)
1 file modified
src/query.cpp (+1/-1)
To merge this branch: bzr merge lp:~boiko/calls-scope/fix_event_processing
Reviewer Review Type Date Requested Status
Kyle Nitzsche (community) Needs Fixing
Review via email: mp+276044@code.launchpad.net

Commit message

In the second step, process only the new events, not the whole list.

Description of the change

In the second step, process only the new events, not the whole list.

To post a comment you must log in.
Revision history for this message
Kyle Nitzsche (knitzsche) wrote :

LGTM. I will approve, merge, and re-release for validation & publishing

review: Approve
Revision history for this message
Kyle Nitzsche (knitzsche) wrote :

I am still seeing duplicated events.

For example, my db only has two events for 2015-10-28 (the third one is 10-27 and all the rest are older):
ofono/ofono/account0|9788955658|9788955658:Wed Oct 28 19:21:03 2015|asender|2015-10-28T19:21:03.106|1|130|0|
ofono/ofono/account0|50898155114|50898155114:Wed Oct 28 19:21:03 2015|asender|2015-10-28T19:21:03.106|1|130|1|
ofono/ofono/account0|4132670429|4132670429:Tue Oct 27 19:21:03 2015|asender|2015-10-27T19:21:03.106|1|130|0|

but the gui shows two entries today (10-28) and reports EACH as having two calls:
(2) (details)
(2) (details)

And I inserted debug statements in the two places where events can be added and I see it called four times:
                    l_toadd.append(event);
                    qDebug() << "=== CALLS. adding event timestamped: " << ev_date.toString();

And here's the debug output, note FOUR today (oct 28), then oct 27 and etc:
=== CALLS. adding event timestamped: "Wed Oct 28 2015"
=== CALLS. adding event timestamped: "Wed Oct 28 2015"
=== CALLS. adding event timestamped: "Wed Oct 28 2015"
=== CALLS. adding event timestamped: "Wed Oct 28 2015"
=== CALLS. adding event timestamped: "Tue Oct 27 2015"

review: Needs Fixing
Revision history for this message
Kyle Nitzsche (knitzsche) wrote :

The problem seems to be that we are sometimes processing events multiple times in a given date rate. For example, for today range, since there are no existing events, first it adds new events, then it loops and processes existing events, thus adding today's events twice.

but, on each call of getEventsForDateRange(..) we only need to process existing events once, then page through new events.

http://bazaar.launchpad.net/~boiko/calls-scope/fix_event_processing/view/head:/src/query.cpp#L117

By moving the Q_FOREACH() loop before the loop, then looping through events pages to get new events, it seems to work fine.

Revision history for this message
Kyle Nitzsche (knitzsche) wrote :

I've implemented the fix above here:
lp:~knitzsche/calls-scope/fix_event_processing_fixMR

Due to schedule, I am going to merge that and release to validation as 1.5.

Revision history for this message
Kyle Nitzsche (knitzsche) wrote :

merged to trunk, and 1.5 attached to bug 1511014

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/query.cpp'
2--- src/query.cpp 2015-10-16 21:50:45 +0000
3+++ src/query.cpp 2015-10-28 18:47:47 +0000
4@@ -148,7 +148,7 @@
5 ev_l.append(l);
6
7 // and process them too
8- Q_FOREACH(const Event &event, ev_l) {
9+ Q_FOREACH(const Event &event, l) {
10 QDate ev_date = event.timestamp().date();
11
12 // if the date is newer than the end date, keep searching

Subscribers

People subscribed via source and target branches