-
Notifications
You must be signed in to change notification settings - Fork 141
Open
Description
Is your feature request related to a problem? Please describe.
As of v2.0.0
, the proxy gets restarted when adding a new origin:
/src/routes/repo.js
let newOrigin = true;
const existingHosts = await getAllProxiedHosts();
existingHosts.forEach((h) => {
// assume SSL is in use and that our origins are missing the protocol
if (req.body.url.startsWith(`https://${h}`)) {
newOrigin = false;
}
});
// create the repository
const repoDetails = await db.createRepo(req.body);
const proxyURL = getProxyURL(req);
// return data on the new repoistory (including it's _id and the proxyUrl)
res.send({ ...repoDetails, proxyURL, message: 'created' });
// restart the proxy if we're proxying a new domain
if (newOrigin) {
console.log('Restarting the proxy to handle an additional host');
await theProxy.stop();
await theProxy.start();
}
Since this causes a small downtime that may interrupt other users, we should refactor it to update the hosts without restarting, or at the very least making sure that other operations don't get interrupted.
Describe the solution you'd like
Refactor the routes/repo
code to update the hosts without restarting (ideally).
Additional context
Original implementation PR: #1043
Metadata
Metadata
Assignees
Labels
No labels