Steps
- Create a
Python 3.7
virtualenv and activate it. - Clone the repository -:
git clone https://github.com/pygaur/ratestask.git
cd
to App -:cd ratestask/ratestask
- Install dependencies :-
pip install requirements/dev.txt
- create database in postgres.
- migrate your models -
python manage.py migrate
- run server
python manage.py runserver
10-12 hrs
Each time my API will receive request to update price, I will publish a message to a message broker(rabbitmq).
I will write consumers which will be processing these rabbitmq messages.
With above approach i am providing -
- Processing price update in background (we can make it super scale)
- setting up retry queues(we will retry if any error comes in processing)
- I can use multi processing( run more than 1 consumer in parallel) to process heavy data.
- system will be highly decoupled
Tech Stack :- Flask , celery , rabbitmq , postgres, redis.
NOTE
Have not written unit test cases for this app due to time constraint.