In case if GitHub rejects requests (for example because of throttling) the script downloads the same attachment and uploads them to S3 many times (depends on how many times script is executed)
The reason is asynchronous nature of the script. The script downloads GitLab tickets, parses them and downloads attachments ahead. The file name for attachment is generated based on some random number generator (rather than checksum). Thus if I run the script many times, it downloads the same file many times and generates new name for the file.
Following is code in the utils.ts, which causes this behavior:
const id = crypto.randomBytes(16).toString('hex');
const newFileName = id + basename;
const relativePath = githubRepoId ? `${githubRepoId}/${newFileName}` : newFileName;
In case if GitHub rejects requests (for example because of throttling) the script downloads the same attachment and uploads them to S3 many times (depends on how many times script is executed)
The reason is asynchronous nature of the script. The script downloads GitLab tickets, parses them and downloads attachments ahead. The file name for attachment is generated based on some random number generator (rather than checksum). Thus if I run the script many times, it downloads the same file many times and generates new name for the file.
Following is code in the
utils.ts
, which causes this behavior: