From 3f48111ae7ab090ed42a43f06af3c86979956f62 Mon Sep 17 00:00:00 2001 From: Boris Tane Date: Sun, 1 Oct 2023 19:06:32 +0100 Subject: [PATCH] reduce frequency --- ping/ping.js | 48 ++++++++++++++++++++++----------------------- ping/serverless.yml | 2 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ping/ping.js b/ping/ping.js index 9970cac..1e59f51 100644 --- a/ping/ping.js +++ b/ping/ping.js @@ -89,7 +89,7 @@ async function ping() { "Abra", ]; - const requests = ["search", "scan", "get", "get", "get", "get", "get", "get", "get", "get"].flatMap((el) => Array(random(1, 15)).fill(el)).sort(() => Math.random() - 0.5); + const requests = ["search", "scan", "get", "get", "get", "get", "get", "get", "get", "get"].map((el) => Array(random(1, 3)).fill(el)).sort(() => Math.random() - 0.5); for (let req of requests) { try { @@ -109,30 +109,30 @@ async function ping() { await wait(1000); } - const messages = [ - `Pikachu's cheeks spark with electric energy.`, - `Charizard's flames light up the night sky.`, - `Eevee evolves into various powerful forms.`, - `Bulbasaur carries a plant bulb on its back.`, - `Jigglypuff sings a lullaby that causes sleep.`, - `Gyarados emerges from raging waters.`, - `Team Rocket's motto: "To protect the world from devastation."`, - `Mewtwo is a genetically engineered Pokémon.`, - `Snorlax dozes peacefully, blocking pathways.`, - `Ash Ketchum dreams of becoming a Pokémon Master.`, - `Meowth speaks in human language.`, - `Jolteon's fur crackles with electric charge.`, - `Squirtle's water cannons blast opponents away.`, - `Gengar hides in the shadows, causing mischief.`, - `Bulbasaur evolves into Ivysaur, then Venusaur.`, - `Onix is a massive, serpentine rock Pokémon.`, - `Vaporeon's body shimmers with water molecules.`, - `Ditto transforms into any Pokémon it sees.`, - `Pidgeotto soars gracefully through the sky.`, - `Eevee adapts to different environments and evolves.`, - ]; + // const messages = [ + // `Pikachu's cheeks spark with electric energy.`, + // `Charizard's flames light up the night sky.`, + // `Eevee evolves into various powerful forms.`, + // `Bulbasaur carries a plant bulb on its back.`, + // `Jigglypuff sings a lullaby that causes sleep.`, + // `Gyarados emerges from raging waters.`, + // `Team Rocket's motto: "To protect the world from devastation."`, + // `Mewtwo is a genetically engineered Pokémon.`, + // `Snorlax dozes peacefully, blocking pathways.`, + // `Ash Ketchum dreams of becoming a Pokémon Master.`, + // `Meowth speaks in human language.`, + // `Jolteon's fur crackles with electric charge.`, + // `Squirtle's water cannons blast opponents away.`, + // `Gengar hides in the shadows, causing mischief.`, + // `Bulbasaur evolves into Ivysaur, then Venusaur.`, + // `Onix is a massive, serpentine rock Pokémon.`, + // `Vaporeon's body shimmers with water molecules.`, + // `Ditto transforms into any Pokémon it sees.`, + // `Pidgeotto soars gracefully through the sky.`, + // `Eevee adapts to different environments and evolves.`, + // ]; - const rand = random(0, messages.length - 1, Math.round(messages.length / 2), 1); + // const rand = random(0, messages.length - 1, Math.round(messages.length / 2), 1); // await sns // .publish({ diff --git a/ping/serverless.yml b/ping/serverless.yml index ebd84d9..25fa03a 100644 --- a/ping/serverless.yml +++ b/ping/serverless.yml @@ -31,6 +31,6 @@ functions: timeout: 90 handler: ping.ping events: - - schedule: rate(3 minutes) + - schedule: rate(1 minute) environment: TOPIC_ARN: arn:aws:sns:eu-west-1:522104763258:poke-topic-prod \ No newline at end of file