Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prune Media Job delays app startup #1550

Open
2 tasks
himeshr opened this issue Nov 27, 2024 · 1 comment
Open
2 tasks

Prune Media Job delays app startup #1550

himeshr opened this issue Nov 27, 2024 · 1 comment

Comments

@himeshr
Copy link
Contributor

himeshr commented Nov 27, 2024

Describe the bug
Issue reported as part of Urgent ticket
In any organisation, where there are media FormElements, as we keep downloading or uploading media content through Avni app, we'll grow the number of media items that have to be checked for expiry. For each of this media items, we check across all entities mediaObservation fields for match, this takes a large amount of time for even relatively small number of synced entities. As Background jobs run on every app start up, the user faces this issue every time he opens app.

For user with N synced entities and M media items, we can potentially end up performing N * M search at every App start-up, ruining User's App Launch experience.

To Reproduce
Steps to reproduce the behavior:
Using any version of Avni APK

  1. Login as any user for goonj
  2. Perform sync
  3. Navigate to Activities list page and randomly download media-items
  4. Restart the app
  5. Observe that app splash screen stays on for longer and longer duration of time as we download more media-items

Expected behavior
The download of more and more media-items shouldnot exponentially increase the app launch time.

Screenshots
Refer ticket, noordeen user recording

Technical inputs

  • Ensure the PruneMedia Job is not run on every app launch, but rather only once a week or even once a month
  • Ensure Order of Growth for PruneMedia job is better than O(N^2), which is the case now

Smartphone (please complete the following information):

  • Device: Any
  • Version 10.1.0 and earlier

Developer Checklist
Developer fixing the bug should fill this checklist.

  • Does the fix require extensive regression testing?
  • Are you mentioning the required scenarios that could be affected?

Discussion points:

  • Show a progress bar with message to let know user what is happening - this need to be made once in
  • Why cant we delete it once sync is done? ie., once the replacement of observations is done? that is in post Sync - this will save us from the need of traversing all the observations.

Standup discussion inputs

  • We do not have instances where the job effectively deletes media, as the catchment doesn't change in general then the entities will remain pointing to the media content, rendering the prune job ineffective
  • We should also think of making this a User triggered operation than Automatic Background job
@github-project-automation github-project-automation bot moved this to New Issues in Avni Product Nov 27, 2024
@himeshr himeshr moved this from New Issues to Analysis Complete in Avni Product Nov 27, 2024
@himeshr himeshr moved this from Analysis Complete to Focus Items in Avni Product Nov 28, 2024
@mahalakshme mahalakshme moved this from Focus Items to In Analysis in Avni Product Nov 28, 2024
@mahalakshme mahalakshme moved this from In Analysis to In Analysis Review in Avni Product Nov 28, 2024
@himeshr
Copy link
Contributor Author

himeshr commented Dec 2, 2024

Vivek's input for this card was to not optimize this job and remove it permanently, in-line with Joy's input on the lack of need for such a job for Majority of the Users..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Analysis Review
Development

No branches or pull requests

1 participant