Skip to content

Commit e72bcfe

Browse files
authored
Merge pull request #1459 from hackmdio/feat/improve-version-check
Improve version checker behavior
2 parents c1028f3 + bd508b1 commit e72bcfe

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/web/middleware/checkVersion.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ async function checkVersion (ctx) {
3030
const { statusCode, body: data } = await rp({
3131
url: `${VERSION_CHECK_ENDPOINT}?v=${config.version}`,
3232
method: 'GET',
33-
json: true
33+
json: true,
34+
timeout: 3000
3435
})
3536

3637
if (statusCode !== 200 || data.status === 'error') {
37-
logger.error('Version check failed.')
38+
logger.warn('Version check failed.')
3839
return
3940
}
4041

@@ -46,12 +47,12 @@ async function checkVersion (ctx) {
4647
if (!data.latest) {
4748
const { version, link } = data.versionItem
4849

49-
logger.warn(`Your CodiMD version is out of date! The latest version is ${version}. Please see what's new on ${link}.`)
50+
logger.info(`Your CodiMD version is out of date! The latest version is ${version}. Please see what's new on ${link}.`)
5051
}
5152
} catch (err) {
5253
// ignore and skip version check
53-
logger.error('Version check failed.')
54-
logger.error(err)
54+
logger.warn('Version check failed.')
55+
logger.warn(err)
5556
}
5657
}
5758

0 commit comments

Comments
 (0)