From 3b13fb114155a7a9f9d7c73d51515845bbb64e48 Mon Sep 17 00:00:00 2001 From: Theo Bob Massard Date: Mon, 18 Apr 2022 15:20:32 +0200 Subject: [PATCH 1/3] ci(cache): setup buildx gha cache Signed-off-by: Theo Bob Massard --- .github/workflows/main.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index db755b4..1868c57 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -102,6 +102,8 @@ jobs: with: context: "${{ matrix.target.src }}" push: true + cache-from: type=gha + cache-to: type=gha,mode=max tags: | "ghcr.io/${{ env.GITHUB_REPOSITORY }}:${{ steps.slugify-src.outputs.target-slug }}-latest" "ghcr.io/${{ env.GITHUB_REPOSITORY }}:${{ steps.slugify-src.outputs.target-slug }}-${{ needs.release.outputs.new_release == 'true' && needs.release.outputs.release_version || env.GITHUB_REF_SLUG }}" From 45b8fe1d192abdfd0d9b1189361c47a44994a56c Mon Sep 17 00:00:00 2001 From: Theo Bob Massard Date: Thu, 21 Apr 2022 15:41:17 +0200 Subject: [PATCH 2/3] feat(sqs): add logs to the producer Signed-off-by: Theo Bob Massard --- sqs/producer/app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sqs/producer/app.py b/sqs/producer/app.py index fab41bc..fcae610 100644 --- a/sqs/producer/app.py +++ b/sqs/producer/app.py @@ -12,7 +12,8 @@ def main(): while True: send_message(sqs) - sleep(5) + print("sent a message, going to sleep") + sleep(15) def send_message(sqs_client): # Send message to SQS queue From f0b9c80c0b31fef15935c87c3092231c1bffa0bd Mon Sep 17 00:00:00 2001 From: Theo Bob Massard Date: Thu, 21 Apr 2022 15:49:57 +0200 Subject: [PATCH 3/3] feat(producer): variabilize sleep duration Signed-off-by: Theo Bob Massard --- sqs/producer/README.md | 2 ++ sqs/producer/app.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sqs/producer/README.md b/sqs/producer/README.md index 03a7d91..0501b9e 100644 --- a/sqs/producer/README.md +++ b/sqs/producer/README.md @@ -7,6 +7,8 @@ Send messages to an AWS SQS Queue. Set the `SQS_QUEUE_URL` environment variable to the value of the SQS Queue that will be used as the target. +The sleep duration can be configured using the `SLEEP_DURATION_SECONDS` environment variable (defaults to `15` seconds). + ## Usage ```console diff --git a/sqs/producer/app.py b/sqs/producer/app.py index fcae610..2b4fde1 100644 --- a/sqs/producer/app.py +++ b/sqs/producer/app.py @@ -5,6 +5,7 @@ # https://sqs..amazonaws.com/111111111111/my-queue QUEUE_URL = os.environ.get('SQS_QUEUE_URL') +SLEEP_DURATION_SECONDS = int(os.environ.get('SLEEP_DURATION_SECONDS', "15")) def main(): # Create SQS client @@ -13,7 +14,7 @@ def main(): while True: send_message(sqs) print("sent a message, going to sleep") - sleep(15) + sleep(SLEEP_DURATION_SECONDS) def send_message(sqs_client): # Send message to SQS queue