mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-30 02:56:20 -05:00
Merge pull request #3224 from LLK/hotfix/remove-deploy-enslowening
Revert "Merge pull request #3217 from LLK/hotfix/fastly-concurrency"
This commit is contained in:
commit
3269565079
1 changed files with 6 additions and 8 deletions
|
@ -8,8 +8,6 @@ var routeJson = require('../src/routes.json');
|
||||||
const FASTLY_SERVICE_ID = process.env.FASTLY_SERVICE_ID || '';
|
const FASTLY_SERVICE_ID = process.env.FASTLY_SERVICE_ID || '';
|
||||||
const S3_BUCKET_NAME = process.env.S3_BUCKET_NAME || '';
|
const S3_BUCKET_NAME = process.env.S3_BUCKET_NAME || '';
|
||||||
|
|
||||||
const FASTLY_CONCURRENCY = process.env.FASTLY_CONCURRENCY || 1;
|
|
||||||
|
|
||||||
var fastly = require('./lib/fastly-extended')(process.env.FASTLY_API_KEY, FASTLY_SERVICE_ID);
|
var fastly = require('./lib/fastly-extended')(process.env.FASTLY_API_KEY, FASTLY_SERVICE_ID);
|
||||||
|
|
||||||
var extraAppRoutes = [
|
var extraAppRoutes = [
|
||||||
|
@ -94,7 +92,7 @@ async.auto({
|
||||||
}],
|
}],
|
||||||
appRouteRequestConditions: ['version', function (results, cb) {
|
appRouteRequestConditions: ['version', function (results, cb) {
|
||||||
var conditions = {};
|
var conditions = {};
|
||||||
async.eachOfLimit(routes, FASTLY_CONCURRENCY, function (route, id, cb2) {
|
async.forEachOf(routes, function (route, id, cb2) {
|
||||||
var condition = {
|
var condition = {
|
||||||
name: fastlyConfig.getConditionNameForRoute(route, 'request'),
|
name: fastlyConfig.getConditionNameForRoute(route, 'request'),
|
||||||
statement: 'req.url ~ "' + route.pattern + '"',
|
statement: 'req.url ~ "' + route.pattern + '"',
|
||||||
|
@ -114,7 +112,7 @@ async.auto({
|
||||||
}],
|
}],
|
||||||
appRouteHeaders: ['version', 'appRouteRequestConditions', function (results, cb) {
|
appRouteHeaders: ['version', 'appRouteRequestConditions', function (results, cb) {
|
||||||
var headers = {};
|
var headers = {};
|
||||||
async.eachOfLimit(routes, FASTLY_CONCURRENCY, function (route, id, cb2) {
|
async.forEachOf(routes, function (route, id, cb2) {
|
||||||
if (route.redirect) {
|
if (route.redirect) {
|
||||||
async.auto({
|
async.auto({
|
||||||
responseCondition: function (cb3) {
|
responseCondition: function (cb3) {
|
||||||
|
@ -147,7 +145,7 @@ async.auto({
|
||||||
};
|
};
|
||||||
fastly.setFastlyHeader(results.version, header, cb3);
|
fastly.setFastlyHeader(results.version, header, cb3);
|
||||||
}]
|
}]
|
||||||
}, FASTLY_CONCURRENCY, function (err, redirectResults) {
|
}, function (err, redirectResults) {
|
||||||
if (err) return cb2(err);
|
if (err) return cb2(err);
|
||||||
headers[id] = redirectResults.redirectHeader;
|
headers[id] = redirectResults.redirectHeader;
|
||||||
cb2(null, redirectResults);
|
cb2(null, redirectResults);
|
||||||
|
@ -215,7 +213,7 @@ async.auto({
|
||||||
};
|
};
|
||||||
fastly.setFastlyHeader(results.version, header, cb2);
|
fastly.setFastlyHeader(results.version, header, cb2);
|
||||||
}]
|
}]
|
||||||
}, FASTLY_CONCURRENCY, function (err, redirectResults) {
|
}, function (err, redirectResults) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
cb(null, redirectResults);
|
cb(null, redirectResults);
|
||||||
});
|
});
|
||||||
|
@ -261,12 +259,12 @@ async.auto({
|
||||||
};
|
};
|
||||||
fastly.setFastlyHeader(results.version, header, cb2);
|
fastly.setFastlyHeader(results.version, header, cb2);
|
||||||
}]
|
}]
|
||||||
}, FASTLY_CONCURRENCY, function (err, redirectResults) {
|
}, function (err, redirectResults) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
cb(null, redirectResults);
|
cb(null, redirectResults);
|
||||||
});
|
});
|
||||||
}]
|
}]
|
||||||
}, FASTLY_CONCURRENCY, function (err, results) {
|
}, function (err, results) {
|
||||||
if (err) throw new Error(err);
|
if (err) throw new Error(err);
|
||||||
if (process.env.FASTLY_ACTIVATE_CHANGES) {
|
if (process.env.FASTLY_ACTIVATE_CHANGES) {
|
||||||
fastly.activateVersion(results.version, function (e, resp) {
|
fastly.activateVersion(results.version, function (e, resp) {
|
||||||
|
|
Loading…
Reference in a new issue