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:
commit
5621add6c6
1 changed files with 15 additions and 2 deletions
|
@ -38,6 +38,11 @@ var crypto = require('crypto'),
|
||||||
currentVersion = packageInfo.version;
|
currentVersion = packageInfo.version;
|
||||||
|
|
||||||
function updateCheckError(error) {
|
function updateCheckError(error) {
|
||||||
|
api.settings.edit(
|
||||||
|
{settings: [{key: 'nextUpdateCheck', value: Math.round(Date.now() / 1000 + 24 * 3600)}]},
|
||||||
|
internal
|
||||||
|
).catch(errors.rejectError);
|
||||||
|
|
||||||
errors.logError(
|
errors.logError(
|
||||||
error,
|
error,
|
||||||
'Checking for updates failed, your blog will continue to function.',
|
'Checking for updates failed, your blog will continue to function.',
|
||||||
|
@ -125,12 +130,20 @@ function updateCheckRequest() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
req.write(reqData);
|
req.on('socket', function (socket) {
|
||||||
req.end();
|
// Wait a maximum of 10seconds
|
||||||
|
socket.setTimeout(10000);
|
||||||
|
socket.on('timeout', function () {
|
||||||
|
req.abort();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
req.on('error', function (error) {
|
req.on('error', function (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
req.write(reqData);
|
||||||
|
req.end();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue