oat-sa / tao-release-notes

GNU General Public License v2.0
1 stars 0 forks source link

Timeout error github graphql #14

Open tereshhhchenko opened 3 years ago

tereshhhchenko commented 3 years ago

Logs

Begin oat-sa/tao-core : 46.14.4 -> 48.11.1
➡ Fetching pull requests
➡ Extracting release notes
❎ request to https://api.github.com/graphql failed, reason: connect ETIMEDOUT 140.82.121.6:443
{ FetchError: request to https://api.github.com/graphql failed, reason: connect ETIMEDOUT 140.82.121.6:443
    at ClientRequest.<anonymous> (/home/sv/.nvm/versions/node/v10.24.1/lib/node_modules/@oat-sa/tao-release-notes/node_modules/cross-fetch/node_modules/node-fetch/lib/index.js:1393:11)
    at ClientRequest.emit (events.js:198:13)
    at TLSSocket.socketErrorListener (_http_client.js:401:9)
    at TLSSocket.emit (events.js:198:13)
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  message:
   'request to https://api.github.com/graphql failed, reason: connect ETIMEDOUT 140.82.121.6:443',
  type: 'system',
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT' }

My guess it might be happen due to github api limitations

tereshhhchenko commented 3 years ago

Temp solution on my local that helped me to get release notes for the Prod PR that included a lot of updates. This solution is ad-hoc, it might be improved a lot, the delay probably could be smaller. In src/notes/requests.js.

...
const delay = require('delay');
...
        async getReleaseNotesFromPullRequests(pullRequests = []) {
            const processed = [];
            for (let prData of pullRequests) {
                const version = semver.valid(semver.coerce(prData.title));
                const releaseNotes = await githubClient.extractReleaseNotesFromReleasePR(prData.number);
                processed.push({ version, releaseNotes });
                await delay(300);
            }
            return processed.filter(pr => pr.version && pr.releaseNotes);

            // return (await Promise.all(
            //     pullRequests
            //         .map(async (prData) => {
            //             const version = semver.valid(semver.coerce(prData.title));
            //             const releaseNotes = await githubClient.extractReleaseNotesFromReleasePR(prData.number);
            //             await delay(3000);
            //             // console.log(releaseNotes);
            //             return { version, releaseNotes };
            //         })
            // )).filter(pr => pr.version && pr.releaseNotes);
        }
    };
};