[SR-Users] Dynamic rtimer interval, transaction to replace in-memory dispatcher list

Anton Yabchinskiy Anton.Yabchinskiy at ringcentral.com
Mon Sep 5 09:11:01 CEST 2022


I have two slightly related questions, and would appreciate any advice
on the matter.

The first one is about dynamic `rtimer` (or `timer`) intervals. In the
route, called by the timer process there is a request to a neighbor
service. In the response there's a set of new destinations for
in-memory dispatcher list and some TTL value. And I need to adjust the
timer interval based on this TTL (e.g., timer interval may be 10 min,
but TTL may suggest to request destinations every 5 min since
now). Also, the first call to the timer route should be at T+0, not at
T+interval. As far as I can tell from `rtimer` module implementation,
that's unfeasible. But maybe I'm missing something? Any suggestion on
how one should implement something like this?

The second one is about updating in-memory dispatcher list. After
receiving and parsing new destinations in the timer route, the
previous in-memory destinations must be replaced by these new
destinations. The naive way of doing so would look something like:
`dispatcher.reload` to clear previous list, then a series of
`dispatcher.add` calls to add new destinations. But a failed `add`
call may lead to wrong in-memory destinations set. As far as I
understand I should start using some transaction-aware database for
dispatcher destinations, and literally write a transaction. Are there
any other ways to solve this?

More information about the sr-users mailing list