#2039·probot

ProbotOctokit.defaults() faulty initialization regarding throttling

Author: skywarthCreated Jun 22, 2024Updated Apr 16, 2026

Bug Report

Current Behavior When passing an object to ProbotOctokit.defaults() in testing environment, with retry and throttle properties, it makes no difference and the sequential tests still suffer from throttling.

Since I thought throttling and retry settings were disabled after passing the respective parameters, I've disabled sections of my modules one by one to determine the source of the delay (approx. 3000ms~, constantly, following the first test). At last I was able to determine the delay wasn't tied to my code, it was about throttling settings in Probot's Octokit. Following code, which is the suggested method cited in:

javascript
let probot: Probot=new Probot({
        githubToken: "test",
        Octokit: ProbotOctokit.defaults({//passing object, instead of closure.
            retry: { enabled: false },
            throttle: { enabled: false },
        }),
});

Expected behavior/code When passing an object that contains retry and throttle properties, it is expected for the given parameters to take effect. Which in this context means disabling throttling for testing purposes.

Currently, this behavior is not satisfied.

Environment

  • Probot version(s): 13.2.2
  • Node/npm version: v21.1.0
  • OS: Ubuntu

Possible Solution

This solution is tested, test case and results are down below.

I have found a hotfix to the issue, I've obtained this solution from a good samaritan on another GitHub issue, the WIP app that is developed with Probot also encountered the issue and tackled like so in this commit.

Simply use a closure parameter for the ProbotOctokit.defaults() method instead of an object. Author of the solution suggested spreading the (default ?) options, for my case it wasn't necessary.

Hotfix/solution:

javascript
Octokit: ProbotOctokit.defaults(function(instanceOptions:any) {//notice the closure
    return {
        ...instanceOptions,//not really necessary
        retry: { enabled: false },
        throttle: { enabled: false },
    }
}),
  • My test run on GitHub Actions before applying the solution: Taking 7.18s, 6 seconds was caused by throttling. Run
    • image
  • After applying the solution: Taking 1.2s Run
    • image
  • Commit that differs these runs

Conclusion: The reduction of test run time, from 7.18s to 1.2s, after changing the initialization of ProbotOctokit.defaults() clearly indicates this delay was caused by faulty initialization of the ProbotOctokit.defaults(), which left throttling enabled even though it was stated otherwise via parameter.

Additional context/Screenshots Many thanks to @askoufis and @gr2m for paving the way, I was pulling my hair out before coming across their post.