mirror of
https://github.com/velocitatem/cvfs.git
synced 2026-05-31 08:43:37 +00:00
Initial commit
This commit is contained in:
23
apps/worker/worker.py
Normal file
23
apps/worker/worker.py
Normal 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()
|
||||
Reference in New Issue
Block a user