Running 30s test @ http://rpi:5000/api/v1/url/aaaa
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 489.29ms 196.29ms 1.38s 82.02%
Req/Sec 68.43 31.64 192.00 72.98%
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from celery.schedules import crontab | |
CELERY_BEAT_SCHEDULE = { | |
'monday-statistics-email': { | |
'task': 'myproject.apps.statistics.tasks.monday_email', | |
'schedule': crontab(day_of_week=1, hour=7), | |
}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@celery_app.task | |
def send_good_morning_mail_task(offset=0, limit=100): | |
users = User.objects.filter(is_active=True).order_by('id')[offset:offset + limit] | |
for user in users: | |
send_good_morning_mail(user) | |
if len(users) >= limit: | |
send_good_morning_mail_task.delay(offset + limit, limit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from celery import group | |
@celery_app.task | |
def calculate_service_provider_task(user_id, provider_id): | |
user = User.objects.get(pk=user_id) | |
provider = ServiceProvider.objects.get(pk=provider_id) | |
return calculate_service_provider(user, provider) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from django.core.mail import send_mail | |
from django.template import Engine, Context | |
from myproject.celery import app | |
def render_template(template, context): | |
engine = Engine.get_default() |
OlderNewer