Skip to content

SDK polling interval should use exponential backoff #39

Open
@NHDaly

Description

@NHDaly

It's currently hard-coded at 3 seconds which is too long for short queries:

interval = 3 * 1000, // 3 seconds

For example, the following 3 queries all report a time of 4.5 seconds in the console (1.5 seconds to return from the fast-path + 3 seconds until the next poll):

def insert:x = 2 * range[1,100 * 1000000,1]
def insert:x = 2 * range[1,200 * 1000000,1]
def insert:x = 2 * range[1,400 * 1000000,1]

But this one took 10.5 seconds (two more polling periods):

def insert:x = 2 * range[1,800 * 1000000,1]

We should instead use an exponential backoff for the polling period, similar to what we do in Julia:
https://github.com/RelationalAI/rai-sdk-julia/blob/935d4f1fe50e675ee462e290a0d3301a2d66d0a0/src/api.jl#L408-L419

Or, even better, Todd has suggested that we should set a much smaller exponent, based on the amount of time we've waited so far, rather than based on the time we slept for last. This is probably a better design, but might be a bit more work:
https://github.com/RelationalAI/rai-sdk-issues/issues/58

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions