openedx / openedx/edx-django-utils

Investigate and possibly replace _ReadReplicaRouterStorage

Open
#537 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
28
Forks
31
Avg merge
7d 6h
Merged PRs (30d)
1

Description

_ReadReplicaRouterStorage is a thread local, and may need to be replaced with a contextvar to make things async-friendly. It's possible that built-in Django functionality now exists to do the same thing, and we can replace this altogether.

https://github.com/openedx/edx-django-utils/blob/fe75e9703e4bf880edf64fd67055ffc53f5d99c6/edx_django_utils/db/read_replica.py#L107-L113

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in edx_django_utils/db/read_replica.py, especially the _ReadReplicaRouterStorage definition around lines 107-113. Investigate how the thread-local state is used and compare contextvars with any relevant built-in Django functionality for async compatibility. Done means documenting a justified replacement decision or confirming why the current implementation should remain.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend, database
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.