Commit 8dc0c492 authored by Lukas Böhm's avatar Lukas Böhm
Browse files

fixed rq

and fixed docker-compose.
parent 9ef4c385
import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from redis import Redis
from rq import Queue
print('WE GOIN IN BOIS')
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
......@@ -16,6 +18,8 @@ app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['MAX_MEDIA_SIZE'] = 1000 * 1024 * 1024 # 1000 MB
db = SQLAlchemy(app)
# task_queue = Queue(connection=Redis(host='chiefsend-redis', port=6379))
task_queue = Queue(connection=Redis.from_url('redis://chiefsend-redis'))
from app.models import *
......
......@@ -7,10 +7,22 @@ from app.models import Share, Attachment
from app.forms import UploadForm
from shutil import make_archive
from app import task_queue
def test_rq():
return 'Hello weld'
@app.route('/secret')
def secret():
return 'Max wird gecückd'
from datetime import timedelta
import time
job = task_queue.enqueue_in(timedelta(seconds=5), test_rq)
for _ in range(15):
print(job.result)
time.sleep(1)
return str(job)
@app.route('/privacy')
......
......@@ -16,7 +16,11 @@ services:
rq:
container_name: "chiefsend-tasks"
image: chiefsend:latest
entrypoint: rq worker --with-scheduler --url redis://chiefsend-redis
volumes:
- type: volume
source: chiefsend-vol
target: /home/chiefsend/data
entrypoint: rq worker --with-scheduler --url redis://chiefsend-redis # connect to redis hostname
web:
container_name: "chiefsend-web"
......@@ -29,5 +33,6 @@ services:
source: chiefsend-vol
target: /home/chiefsend/data
volumes:
chiefsend-vol:
\ No newline at end of file
chiefsend-vol:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment