Closed shankari closed 1 year ago
After much investigation in an internal issue, which we will not duplicate here, since we don't want to upload arbitrary server logs, we figured out that this was not due to server slowness.
Focusing on the actual data retrieval, I do see an occasional 2 sec load, but it is only intermittent. I don't see any reason from the server on why the user should encounter persistent load issues.
1693750430844,"2023-09-03 14:13:50,844:DEBUG:140614301627968:END POST /datastreams/find_entries/timestamp ... 2.0893216133117676 "
1693751913259,"2023-09-03 14:38:33,259:DEBUG:140613873825344:END POST /datastreams/find_entries/timestamp ... 0.7897429466247559 "
1693763285315,"2023-09-03 17:48:05,315:DEBUG:140614818367040:END POST /datastreams/find_entries/timestamp ... 0.21491742134094238 "
1693764831002,"2023-09-03 18:13:51,002:DEBUG:140614492628544:END POST /datastreams/find_entries/timestamp ... 2.274151086807251 "
1693765531771,"2023-09-03 18:25:31,770:DEBUG:140614301627968:END POST /datastreams/find_entries/timestamp ... 0.20230770111083984 "
Fortunately, we were able to reproduce the error in the emulator. This is 100% reproducible.
[Error] Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'word[0].toUpperCase')
step (bundle.js:60708)
fulfilled (bundle.js:60609)
promiseReactionJob
This occurs in valueToOtherText
:
The user's otherValue
is "drove_to bike night "
and the trailing space causes the error because we split by " "
and end up with an empty string that we try to capitalize the first letter of.
As far as I can tell, it's always been like this, so maybe we've just been lucky to not have people put trailing spaces in their 'other' text until now.
I see 3 takeaways from this:
"drove_to bike night "
when we accepted their input, which is not what we really wanted.
str.replace(' ', '_')
only does the first occurrence. To do all occurences you need str.replace(/ /g, '_')
. I was already planning on fixing this)"drove_to bike night "
is already recorded in the DB, so we do have to deal with it. When reading, we should remove any leading/trailing spaces (the JS trim()
method does this)Fixed this in the server DB as a workaround. Principled fix coming in next release. Note that it is not sufficient to change only the user input, we also had to change the confirmed and composite trips since the input had already been processed.
>>> edb.get_timeseries_db().update_one({"metadata.key": "manual/replaced_mode", "user_id": testuuid, "data.label": "drove_to bike night "}, {"$set": {"data.label": "drove_to_bike_night"}})
>>> edb.get_analysis_timeseries_db().update_one({"metadata.key": "analysis/confirmed_trip", "user_id": testuuid, "data.user_input.replaced_mode": "drove_to bike night "}, {"$set": {"data.user_input.replaced_mode": "drove_to_bike_night"}})
>>> edb.get_analysis_timeseries_db().update_one({"metadata.key": "analysis/composite_trip", "user_id": testuuid, "data.user_input.replaced_mode": "drove_to bike night "}, {"$set": {"data.user_input.replaced_mode": "drove_to_bike_night"}})
Added custom labels, including trailing spaces, to a study environment. Took a trip. Data reloaded properly. Marking this as closed...
we had a report from a user that their app was hanging. "it has been like this since Saturday"