Skip to content

Duplicated attachments in case of throttling #107

@ujos

Description

@ujos

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;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions