fix post delays #2

This commit is contained in:
Win 2024-07-18 19:16:51 +07:00
parent 56c57c5983
commit bf9b0298bb
1 changed files with 8 additions and 7 deletions

View File

@ -95,11 +95,12 @@ app.get('/callback', function(req, res) {
console.log("Scanned size: " + fetch_static_image_size); console.log("Scanned size: " + fetch_static_image_size);
if(fetch_static_image_size != curr_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!"); console.log("File size change detected!");
await Fetch.save_image(static_image_url, static_radar_path); await Fetch.save_image(static_image_url, static_radar_path);
await Fetch.save_image(animated_image_url, animated_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 // Fetch static image
let static_radar_image_name = `${raw_date.toISOString()}.jpg`; 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); 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) { if(post_note.createdNote) {
console.log("Note created!"); console.log("Note created!");
post_lap++;
if(post_lap == 12) { if(post_lap == 12) {
post_lap = 0; post_lap = 0;
} }
} else { } else {
console.log("Note was not created"); console.log("Note was not created");
} }
} }
post_lap++;
} else { } else {
console.log("No change in data, go on."); console.log("No change in data, go on.");
} }