0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Merge pull request #4040 from halfdan/4036-update-check

Delay updateCheck to +24h on error
This commit is contained in:
Hannah Wolfe 2014-09-19 16:30:51 +01:00
commit 5621add6c6

View file

@ -38,6 +38,11 @@ var crypto = require('crypto'),
currentVersion = packageInfo.version;
function updateCheckError(error) {
api.settings.edit(
{settings: [{key: 'nextUpdateCheck', value: Math.round(Date.now() / 1000 + 24 * 3600)}]},
internal
).catch(errors.rejectError);
errors.logError(
error,
'Checking for updates failed, your blog will continue to function.',
@ -125,12 +130,20 @@ function updateCheckRequest() {
});
});
req.write(reqData);
req.end();
req.on('socket', function (socket) {
// Wait a maximum of 10seconds
socket.setTimeout(10000);
socket.on('timeout', function () {
req.abort();
});
});
req.on('error', function (error) {
reject(error);
});
req.write(reqData);
req.end();
});
});
}