From 4dd3834334aa830fbacbecb6e93d4cb06bbcf75f Mon Sep 17 00:00:00 2001 From: Leslie-Wong-H <79917148leslie@gmail.com> Date: Mon, 17 Jun 2024 17:01:10 +0800 Subject: [PATCH] Move isIpv6 judgement ahead --- src/search.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/search.js b/src/search.js index 3a5ba27..6bc1a42 100644 --- a/src/search.js +++ b/src/search.js @@ -53,6 +53,14 @@ const search = async (image) => { return [response]; }; +let isIpv6 = false; +try { + isIpv6 = Boolean(await publicIpv6()); +} catch (error) { + console.log(error); + isIpv6 = false; +} + const logAndDequeue = async (knex, redis, uid, priority, status, searchTime, accuracy) => { if (status === 200) { const searchCountCache = await knex("search_count").where({ uid: `${uid}` }); @@ -166,14 +174,6 @@ export default async (req, res) => { }); } - let isIpv6 = false; - try { - isIpv6 = Boolean(await publicIpv6()); - } catch (error) { - console.log(error); - isIpv6 = false; - } - const response = await fetch( [ // "api.telegram.org",