jeudi 22 octobre 2020

How to make tinder like instant match taking caching in account (Cache and real time match)

I am working on POC for a tinder-like mobile application using flutter for mobile development and AWS serverless as the core for the business logic. Things are good so far although we experience a very interesting issue and I am not sure what is the best solution to handle it.

The problem is that I want to do a semi real-time matching like exactly in tinder. So when I open the app I will get some other users' cards to like/dislike and if I liked someone who had liked me before so it's a match. Up until now, it's straightforward as when I open the app I will get 10 users to like/dislike and each user entity includes even if he liked me or no and there is pagination so each time I get 10 users' cards from the server and caching them.

There is a scenario when for example I liked someone who just liked me 3 seconds ago so my cache isn't up to date? In this case, I will miss a match. Also, we are using Dynamodb so we are relaxing updating the records so that's means I will not do any comparison before updating the record on the server-side. Also, I don't want to send a request to the server to get cards one by one so the performance will be not that good. So what to do in that case?

Also, designing way, Is it better ideas on how to that using server caching, queues, long polling, or any simple idea? Also, I am delighted to know how that's already implemented in the tinder app itself?

Aucun commentaire:

Enregistrer un commentaire