Skip to content

Instantly share code, notes, and snippets.

View antunesleo's full-sized avatar

Leonardo Antunes antunesleo

View GitHub Profile
from time import sleep
import requests
UNSTABLE_API = "https://httpbin.org/status/200,500"
def notsodumbretry(max_attempts, retry_backoff, backoff_exponential):
succeeded = False
attempts = 0
import requests
UNSTABLE_API = "https://httpbin.org/status/200,500,503,401"
def dumbretry():
succeeded = False
attempts = 0
while not succeeded:
api_1 | [12/May/2023 17:42:32] "POST /notes HTTP/1.1" 200 80
relayer_1 | note-created event published to Kafka
consumer_1 | {'name': 'note-created', 'note': {'id': 3, 'title': 'My Note Title', 'content': 'This is the content of my note', 'created_at': '2023-05-12 17:42:32', 'updated_at': '2023-05-12 17:42:32'}}
docker-compose run api python manage.py migrate
relayer:
build: .
command: python manage.py events_relay --run-in-loop
volumes:
- .:/app
env_file:
- .env
depends_on:
kafka:
condition: service_healthy
from jaiminho.send import save_to_outbox
@save_to_outbox
def publish_note_created(note_dict):
python manage.py migrate
from jaiminho.constants import PublishStrategyType
JAIMINHO_CONFIG = {
"PUBLISH_STRATEGY": PublishStrategyType.KEEP_ORDER,
}