susamn / rio

A lightweight job scheduler based on priority queue with timeout, retry, replica, context cancellation and easy semantics for job chaining. Build for golang web apps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add replica calls to services and pick the correct one based on some condition

susamn opened this issue · comments

Think about a backend having 3 data centers, and all these data centers are no responding uniformly, some is slow and some are fast.

or

There are multiple datacenters having sync issues. Some data center is updated first and some are later.

Now during this time, if a backend call is made to the slow responding dc or the dc having stale data, the obtained response will be of higher response time or be faulty respectively.

Replica calls can help in this context. If the backend is allowing, Rio should be able to select the one response based on some condition, maybe response time based or some data quality based.

In the latest commit, the replica functionality is added but only for response time condition

Need to add the condition based selection, like data quality