From 099b99fd7a89973cab07bc0368418703f15c8e03 Mon Sep 17 00:00:00 2001 From: mahdavi Date: Mon, 2 Nov 2020 00:26:45 +0330 Subject: [PATCH] more worker --- apps/users/tasks.py | 11 ++++++----- run.sh | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/users/tasks.py b/apps/users/tasks.py index dc7bd82..a13c2f5 100644 --- a/apps/users/tasks.py +++ b/apps/users/tasks.py @@ -2,6 +2,11 @@ from celery import shared_task from django.conf import settings from service_clients import Client, AccountsClient +SCOPES = ['notifications.notification:submit'] +client = Client(client_id=settings.CLIENT_ID, + client_secret=settings.CLIENT_SECRET, + scopes=SCOPES, + grant_type=AccountsClient.GRANT_CLIENT_CREDENTIALS) @shared_task def send_notification(phone_number=None, @@ -10,11 +15,7 @@ def send_notification(phone_number=None, user_uuid=None, email=None, notification_type=1): - SCOPES = ['notifications.notification:submit'] - client = Client(client_id=settings.CLIENT_ID, - client_secret=settings.CLIENT_SECRET, - scopes=SCOPES, - grant_type=AccountsClient.GRANT_CLIENT_CREDENTIALS) + data = { 'phone_number': phone_number, "body": f'{title}:\n{body}' diff --git a/run.sh b/run.sh index 4c9abd5..a4bca79 100644 --- a/run.sh +++ b/run.sh @@ -1,3 +1,3 @@ python3 manage.py collectstatic python3 manage.py migrate -gunicorn gooyal_accounts.wsgi:application --bind 0.0.0.0:8000 \ No newline at end of file +gunicorn gooyal_accounts.wsgi:application --bind 0.0.0.0:8000 -w 4 \ No newline at end of file