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'] } 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({