From 87495d330bf49eeec26512e14f63e606c902a67a Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Tue, 14 Dec 2021 10:29:35 +0300 Subject: [PATCH 1/2] Update update-database.test.js --- tests/commands/update-database.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/commands/update-database.test.js b/tests/commands/update-database.test.js index 1a76932dee..b9bb15413e 100644 --- a/tests/commands/update-database.test.js +++ b/tests/commands/update-database.test.js @@ -96,8 +96,8 @@ it('can update database', () => { }) expect(JSON.parse(lines[4])).toMatchObject({ id: 'KayhanTV.af', - status: { label: 'Timeout', code: 'timeout', level: 4 }, - is_broken: true, + status: { label: 'Geo-blocked', code: 'geo_blocked', level: 2 }, + is_broken: false, updated: true }) expect(JSON.parse(lines[5])).toMatchObject({ From ea1904e810ea72e4038f2161c11b4b61ba61902d Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Tue, 14 Dec 2021 10:29:37 +0300 Subject: [PATCH 2/2] Update update-database.js --- scripts/commands/update-database.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/commands/update-database.js b/scripts/commands/update-database.js index a69e2cc9c7..1d07cc2064 100644 --- a/scripts/commands/update-database.js +++ b/scripts/commands/update-database.js @@ -202,12 +202,12 @@ function parseResolution(streams) { function parseStatus(error, prevStatus) { if (error) { - if (error.includes('timed out')) { + if (['not_247', 'geo_blocked'].includes(prevStatus.code)) { + return prevStatus + } else if (error.includes('timed out')) { return statuses['timeout'] } else if (error.includes('403')) { return statuses['geo_blocked'] - } else if (['not_247', 'geo_blocked'].includes(prevStatus.code)) { - return prevStatus } return statuses['offline'] }