App: HIGH: [Performance] [$250] Stop using `reportAction.originalMessage` or `reportAction.message.text`
Problem:
Each comment in the server database is stored in reportAction.message
in HTML form. However, for some reason lost to time, when we send that same comment out as an Onyx update, we:
- Rename the original message in the database to
reportAction.originalMessage
in the update (which is confusing) - Create a new
message
object that contains a copy of thehtml
message, as well as a strippedtext
version. - Put the
message
object inside a totally unnecessary one-element array
That means every comment is actually sent out three times (four, if you include the update to the report
object, but that’s out of scope for now). This is clearly wasteful in a number of ways:
- It requires postprocessing on the server to do this extraneous operation
- It increases network bandwidth by 3x
- It increases RAM use 3x
- It increases on-device storage 3x
- It’s confusing AF
Additionally, it’s particularly problematic when sending Onyx updates out via UrbanAirship, which is extremely limited in the payload sizes allowed – with anything over a certain limit just dropped quietly and never delivered, causing “gaps” in our update stream (which require more network calls to “backfill” the Onyx data on app open, which makes things slow). Basically, this was just a mistake introduced for reasons we can’t remember, but that we want to undo.
Solution:
To solve this, please:
- Phase 1 (External / clientside): Stop using
originalMessage
, start using array-message
- Update every instance of
originalMessage.html
to usemessage.html || message[0].html
- Update every instance of
message.text
to dynamically strip the text frommessage.html || message[0].html
- Update every instance of
- Phase 2 (Internal / serverside): Once we’ve confirmed the client no longer uses
originalMessage
ormessage.text
:- Stop sending
originalMessage
- Start sending
message
without an array
- Stop sending
- Phase 3 (External / clientside): Remove checking for “array message”
This issue is for phase 1 and phase 3.
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~01856d1399295ef760
- Upwork Job ID: 1776729925881405440
- Last Price Increase: 2024-04-06
- Automatic offers:
- cubuspl42 | Reviewer | 0
About this issue
- Original URL
- State: open
- Created 3 months ago
- Comments: 38 (23 by maintainers)
Thanks @parasharrajat , 👋 @c3024 @c3024 commented on the PR earlier today
@c3024 will review this.
Great! @cubuspl42 what is your ETA for review?
@cubuspl42 The PR is here.
@cubuspl42 Yes, I definitely can
Great question. I’ve updated the original post with a more detailed description of the problem and solutions. Thanks!