Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: option to do redirects after all file uploads #226

Open
gburgett opened this issue Feb 24, 2021 · 0 comments
Open

Request: option to do redirects after all file uploads #226

gburgett opened this issue Feb 24, 2021 · 0 comments

Comments

@gburgett
Copy link
Contributor

Hello,

We've been seeing some consistency issues in our static site during the 30 seconds that we are deploying a new version. In our use case, all of the files have a hash appended to the filename, and we use redirects to control which one is "current".

Since some of these files point to eachother, if we upload a new hash for an index file which points to a new hash of another file, and the redirect for the index file points to the new hash, we can get a 404 on trying to access the other file since it hasn't been uploaded yet. This 404 is resolved within 30 seconds when the other file gets uploaded.

We would like the option to enqueue all redirects at the end of the upload queue, after all the uploads have finished. Our proposed solution is a flag that, when true, awaits the klaw stream before pushing the redirect objects to the upload queue. Something like:

    );
});

if (config.processRedirectsAfterAllFiles) {
  await streamToPromise(stream as Readable);
}

const base = config.protocol && config.hostname ? `${config.protocol}://${config.hostname}` : null;
uploadQueue.push(
    ...redirectObjects.map(redirect =>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant