kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Handle initial device provisioning in an async task rather than a synchronous API request

Open rtibbles opened this issue 1 year ago • 3 comments

Observed behavior

We currently do initial provisioning in a synchronous API request. If this takes a long time, there is a risk that this can timeout, which can lead to a confusing user experience.

This may be exacerbated by running on a platform where cryptography is not usable, either because of the specific Python version, or the OS/architecture it is running on.

Expected behavior

Everything that is done during the serializer create step for provisioning should happen in an asynchronous task defined in kolibri/core/device/tasks.py.

Validation should be moved to a dedicated tasks validator.

Frontend initialization of provisioning should be updated to create the appropriate task.

The frontend should then track the status of the provisioning task and then redirect when the task is complete.

User-facing consequences

Confusion during onboarding.

rtibbles avatar Oct 25 '24 19:10 rtibbles

Hi @rtibbles , I would like to tackle this issue, will you please assign it to me, i would like to make the following changes: 1.Backend changes: => Move the current synchronous provisioning process to an asynchronous background task. =>Refactor the validation logic into a separate task that can be handled in the background. =>Modify the API to start the background task and return a job ID that we can use to track the task’s progress. 2. Frontend changes: => Update the frontend to start the background task when provisioning is triggered. Instead of waiting for the task to complete right away, the frontend will check the status of the task regularly (this is done by using the job ID returned from the backend). =>Show a loading indicator or a progress message while the task is running. Once the task finishes, either show a success message or display an error if something goes wrong. =>Essentially, the frontend will handle showing the user the current status of the provisioning task, rather than leaving them in the dark while it’s happening. 3.Documentation: =>Update the documentation for developers to explain the new background task flow. =>Add information for users on what to expect during provisioning, including what happens if the task takes too long or if any issues arise (e.g., problems with cryptography). I address all aspects of this issue, could you confirm the list of files that you think require changes? Additionally, let me know if there are any specific things I should consider while making these changes. Thank you.

Mamatha1718 avatar Jan 25 '25 13:01 Mamatha1718

Hi @Mamatha1718 - you currently have two issues assigned to you, so I would prefer those are resolved and closed before assigning any more.

rtibbles avatar Jan 26 '25 00:01 rtibbles

@rtibbles , Thanks for your response , I'm currently working on resolving the two assigned issues. I'll close them as soon as possible and turn my attention to this one. Thank You.

Mamatha1718 avatar Jan 26 '25 05:01 Mamatha1718

Fixed in #13102

rtibbles avatar Jul 24 '25 14:07 rtibbles