openedx / openedx/openedx-events
Add utility for resetting consumer Django state before each event
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 13
- Forks
- 33
- Avg merge
- 14h 37m
- Merged PRs (30d)
- 4
Description
Both event-bus-kafka and event-bus-redis call a _reconnect_to_db_if_needed function before processing each event. This ensures that the database connection is in a good state before work begins. In a normal request-driven environment, this would automatically be handled by Django.
We're also adding a call to clear the request cache in event-bus-kafka, in case there are signal receivers that would normally be called in a request context and that rely on the request cache.
openedx-events should probably host a utility function that can be called from each implementation's consume loop in order to generically reset the application state for each new event that needs to be processed. (Also see https://github.com/openedx/openedx-events/issues/236 for the possibility of more general request-like resetting.)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the _reconnect_to_db_if_needed calls in the event-bus-kafka and event-bus-redis consume loops, then review the request-cache change and issue 236. Done means the shared utility's responsibilities are agreed and it can be used by each implementation to reset application state before processing an event.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, distributed-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100