initail setup

This commit is contained in:
2025-10-23 14:58:13 +02:00
parent 0c7b4e8e23
commit 8222e53a0a
5 changed files with 68 additions and 5 deletions

23
backend/worker/main.py Normal file
View File

@@ -0,0 +1,23 @@
import os
import time
from celery import Celery
from dotenv import load_dotenv
load_dotenv()
# Redis connection
redis_url = os.getenv("REDIS_URL", "redis://localhost:6379")
app = Celery('worker', broker=redis_url, backend=redis_url)
@app.task
def simple_task(message):
"""A simple task that processes a message and returns a result"""
time.sleep(2) # Simulate some work
return f"Processed: {message}"
@app.task
def add_numbers(x, y):
"""Simple math task"""
return x + y
if __name__ == '__main__':
app.start()