Skip to content

Refresh User Profile on Demand #28

@ishan-xy

Description

@ishan-xy

Refresh User Data on Demand

Description

Updates to a user's Codeboard profile may take a few minutes to reflect recent activity on LeetCode. To provide a more responsive experience, we need an API endpoint that allows users to manually refresh their profile data on demand.

Suggested Fix:

Create this API endpoint in the leaderboard app and ensure that:

  • The user is authenticated before proceeding.
  • Retrieve the user's username and ID from the Database [Leetcode Model].
  • The user's username and ID are retrieved and passed to get_and_update_user_data() (a Celery task in tasks.py) to fetch and update the data.
  • Prefer running it as a Celery task, though this might impact existing concurrency settings—so check if running the function directly would be a better fit for your setup.

Refer to the Profile(APIView) class in leaderboard/views.py for a similar logic of getting the user instance.

Additional Notes:

  • Running the task asynchronously is ideal, but it may require adjustments based on how it interacts with current concurrency limits.
  • Log the errors properly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    On PriorityExtra attention is neededenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions