message_fetch: Add small backfill delay.

This should help reduce the risk of hitting rate limits when users
have a very large number of messages to fetch via this mechanism.

Inline the `messages` variable that was only used in one place while
we're touching this.
This commit is contained in:
Tim Abbott
2024-02-02 13:11:41 -08:00
parent 370afd6464
commit 624e1a85ce
2 changed files with 22 additions and 10 deletions

View File

@@ -222,6 +222,12 @@ function forward_fill_step() {
let fetch;
self.prep = () => {
/* Don't wait for the timeout before recursively calling `load_messages`. */
const expected_delay = 150;
set_global("setTimeout", (f, delay) => {
assert.equal(delay, expected_delay);
f();
});
fetch = config_fake_channel({
expected_opts_data: initialize_data.forward_fill.req,
});