mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-15 03:01:37 -05:00
Delay updateCheck to +24h on error
fixes #4036 - delay update check by 24h when an error happens - set connection timeout to 10 seconds
This commit is contained in:
parent
28cf0a68d3
commit
0efb449103
1 changed files with 15 additions and 2 deletions
|
@ -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();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue