From bf9b0298bb9382879873c68ae49220f686d5820d Mon Sep 17 00:00:00 2001 From: Win Date: Thu, 18 Jul 2024 19:16:51 +0700 Subject: [PATCH] fix post delays #2 --- src/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index 3d0c3a7..6232174 100644 --- a/src/index.js +++ b/src/index.js @@ -95,11 +95,12 @@ app.get('/callback', function(req, res) { console.log("Scanned size: " + fetch_static_image_size); if(fetch_static_image_size != curr_static_image_size) { - if(post_lap == 0 || post_lap == 12) { // 12 * 5 = 60 - console.log("File size change detected!"); - await Fetch.save_image(static_image_url, static_radar_path); - await Fetch.save_image(animated_image_url, animated_radar_path); + console.log("File size change detected!"); + await Fetch.save_image(static_image_url, static_radar_path); + await Fetch.save_image(animated_image_url, animated_radar_path); + + if(post_lap == 0 || post_lap == 12) { // 12 * 5 = 60 // Fetch static image let static_radar_image_name = `${raw_date.toISOString()}.jpg`; const upload_static_radar = await Post.create_image(host, access_token, static_radar_image_name, static_radar_path); @@ -120,16 +121,16 @@ app.get('/callback', function(req, res) { if(post_note.createdNote) { console.log("Note created!"); - post_lap++; if(post_lap == 12) { post_lap = 0; } - } else { console.log("Note was not created"); } - } + } + + post_lap++; } else { console.log("No change in data, go on."); }