Compare commits
67 Commits
12ce9b1906
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| d5895b8888 | |||
|
|
8799b3107b | ||
| 83718675d7 | |||
|
|
7a2950e480 | ||
| 50a26e0e1d | |||
|
|
7448b4e0c6 | ||
| d670c9375c | |||
| 5e2c725bc2 | |||
| 11fbbf18f4 | |||
| 595dfd0f6d | |||
| 0990f684da | |||
|
|
5fa5789559 | ||
| 232042a523 | |||
|
|
7fcbb316e6 | ||
| eec041bb9d | |||
|
|
e9ecb7d94f | ||
| e8b5092745 | |||
|
|
dbe5df157b | ||
| 6c1288aaab | |||
|
|
f4af02ec1d | ||
| 156e1407ed | |||
| 3408364bc4 | |||
| 18aabe497b | |||
| baa134ae26 | |||
| 144e5d4335 | |||
| fcb2713eaf | |||
| 48ab0d1797 | |||
| ddfd5596d9 | |||
| f8417edc94 | |||
| d2247054e8 | |||
| 292bacc963 | |||
| e76cfc7994 | |||
| ce550c31f4 | |||
| c146fc7f1e | |||
| ba2f1bb768 | |||
| 2425ee2988 | |||
| bc4f74e20f | |||
| 889a20609f | |||
| 4e5d483208 | |||
| 1c3d1566e5 | |||
| 1d00a27b15 | |||
| 2b88479cec | |||
| c3886433ac | |||
| 7238d725dd | |||
| ac1c8745dc | |||
| 4a3fa3c2ab | |||
| 17c9b1b693 | |||
| 45e1c0fe8a | |||
| e286a3078e | |||
| 989f7026ad | |||
| 64e957af2f | |||
| 90378be7c5 | |||
| 272233fc67 | |||
| b8f0624665 | |||
| 95e4f5e8da | |||
| 389ead9018 | |||
|
|
d40dd2c81d | ||
|
|
39e02f3759 | ||
| c1ffaca96b | |||
|
|
0e07ebdc61 | ||
|
|
86a3b891f1 | ||
|
|
f63ce9ee90 | ||
|
|
2ebba22478 | ||
|
|
7ce43cf4b6 | ||
|
|
50d9d1c953 | ||
|
|
ea6f5e2ca4 | ||
| 70d2f4ce52 |
@@ -3,15 +3,16 @@ version: "3.4"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
bot:
|
worker:
|
||||||
image: mathwave/sprint-repo:ruz-bot
|
image: mathwave/sprint-repo:ruz-bot
|
||||||
environment:
|
environment:
|
||||||
MONGO_HOST: "mongo.develop.sprinthub.ru"
|
|
||||||
STAGE: "development"
|
STAGE: "development"
|
||||||
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
|
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
|
||||||
TELEGRAM_TOKEN: $TELEGRAM_TOKEN_DEV
|
networks:
|
||||||
PLATFORM_SECURITY_TOKEN: $PLATFORM_SECURITY_TOKEN
|
- queues-development
|
||||||
command: bot
|
- configurator
|
||||||
|
- mongo-development
|
||||||
|
command: worker
|
||||||
deploy:
|
deploy:
|
||||||
mode: replicated
|
mode: replicated
|
||||||
restart_policy:
|
restart_policy:
|
||||||
@@ -23,11 +24,11 @@ services:
|
|||||||
fetch:
|
fetch:
|
||||||
image: mathwave/sprint-repo:ruz-bot
|
image: mathwave/sprint-repo:ruz-bot
|
||||||
environment:
|
environment:
|
||||||
MONGO_HOST: "mongo.develop.sprinthub.ru"
|
|
||||||
STAGE: "development"
|
STAGE: "development"
|
||||||
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
|
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
|
||||||
TELEGRAM_TOKEN: $TELEGRAM_TOKEN_DEV
|
networks:
|
||||||
PLATFORM_SECURITY_TOKEN: $PLATFORM_SECURITY_TOKEN
|
- queues-development
|
||||||
|
- mongo-development
|
||||||
command: fetch
|
command: fetch
|
||||||
deploy:
|
deploy:
|
||||||
mode: replicated
|
mode: replicated
|
||||||
@@ -40,11 +41,11 @@ services:
|
|||||||
notify:
|
notify:
|
||||||
image: mathwave/sprint-repo:ruz-bot
|
image: mathwave/sprint-repo:ruz-bot
|
||||||
environment:
|
environment:
|
||||||
MONGO_HOST: "mongo.develop.sprinthub.ru"
|
|
||||||
STAGE: "development"
|
STAGE: "development"
|
||||||
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
|
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
|
||||||
TELEGRAM_TOKEN: $TELEGRAM_TOKEN_DEV
|
networks:
|
||||||
PLATFORM_SECURITY_TOKEN: $PLATFORM_SECURITY_TOKEN
|
- queues-development
|
||||||
|
- mongo-development
|
||||||
command: notify
|
command: notify
|
||||||
deploy:
|
deploy:
|
||||||
mode: replicated
|
mode: replicated
|
||||||
@@ -57,13 +58,12 @@ services:
|
|||||||
ruz-bot-nginx:
|
ruz-bot-nginx:
|
||||||
image: mathwave/sprint-repo:ruz-bot
|
image: mathwave/sprint-repo:ruz-bot
|
||||||
networks:
|
networks:
|
||||||
- common-infra-nginx
|
- common-infra-nginx-development
|
||||||
|
- queues-development
|
||||||
|
- mongo-development
|
||||||
environment:
|
environment:
|
||||||
MONGO_HOST: "mongo.develop.sprinthub.ru"
|
|
||||||
STAGE: "development"
|
STAGE: "development"
|
||||||
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
|
MONGO_PASSWORD: $MONGO_PASSWORD_DEV
|
||||||
TELEGRAM_TOKEN: $TELEGRAM_TOKEN_DEV
|
|
||||||
PLATFORM_SECURITY_TOKEN: $PLATFORM_SECURITY_TOKEN
|
|
||||||
command: api
|
command: api
|
||||||
deploy:
|
deploy:
|
||||||
mode: replicated
|
mode: replicated
|
||||||
@@ -74,5 +74,11 @@ services:
|
|||||||
order: start-first
|
order: start-first
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
common-infra-nginx:
|
common-infra-nginx-development:
|
||||||
|
external: true
|
||||||
|
queues-development:
|
||||||
|
external: true
|
||||||
|
configurator:
|
||||||
|
external: true
|
||||||
|
mongo-development:
|
||||||
external: true
|
external: true
|
||||||
|
|||||||
@@ -3,24 +3,20 @@ version: "3.4"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
bot:
|
worker:
|
||||||
image: mathwave/sprint-repo:ruz-bot
|
image: mathwave/sprint-repo:ruz-bot
|
||||||
environment:
|
environment:
|
||||||
MONGO_HOST: "mongo.sprinthub.ru"
|
|
||||||
STAGE: "production"
|
STAGE: "production"
|
||||||
MONGO_PASSWORD: $MONGO_PASSWORD_PROD
|
MONGO_PASSWORD: $MONGO_PASSWORD_PROD
|
||||||
TELEGRAM_TOKEN: $TELEGRAM_TOKEN_PROD
|
networks:
|
||||||
PLATFORM_SECURITY_TOKEN: $PLATFORM_SECURITY_TOKEN
|
- queues
|
||||||
DEBUG: "false"
|
- configurator
|
||||||
command: bot
|
- mongo
|
||||||
|
command: worker
|
||||||
deploy:
|
deploy:
|
||||||
mode: replicated
|
mode: replicated
|
||||||
restart_policy:
|
restart_policy:
|
||||||
condition: any
|
condition: any
|
||||||
placement:
|
|
||||||
constraints:
|
|
||||||
# - node.role == worker
|
|
||||||
- node.labels.zone == ru
|
|
||||||
update_config:
|
update_config:
|
||||||
parallelism: 1
|
parallelism: 1
|
||||||
order: start-first
|
order: start-first
|
||||||
@@ -28,21 +24,18 @@ services:
|
|||||||
fetch:
|
fetch:
|
||||||
image: mathwave/sprint-repo:ruz-bot
|
image: mathwave/sprint-repo:ruz-bot
|
||||||
environment:
|
environment:
|
||||||
MONGO_HOST: "mongo.sprinthub.ru"
|
|
||||||
STAGE: "production"
|
STAGE: "production"
|
||||||
MONGO_PASSWORD: $MONGO_PASSWORD_PROD
|
MONGO_PASSWORD: $MONGO_PASSWORD_PROD
|
||||||
TELEGRAM_TOKEN: $TELEGRAM_TOKEN_PROD
|
|
||||||
PLATFORM_SECURITY_TOKEN: $PLATFORM_SECURITY_TOKEN
|
|
||||||
DEBUG: "false"
|
DEBUG: "false"
|
||||||
|
networks:
|
||||||
|
- queues
|
||||||
|
- configurator
|
||||||
|
- mongo
|
||||||
command: fetch
|
command: fetch
|
||||||
deploy:
|
deploy:
|
||||||
mode: replicated
|
mode: replicated
|
||||||
restart_policy:
|
restart_policy:
|
||||||
condition: any
|
condition: any
|
||||||
placement:
|
|
||||||
constraints:
|
|
||||||
# - node.role == worker
|
|
||||||
- node.labels.zone == ru
|
|
||||||
update_config:
|
update_config:
|
||||||
parallelism: 1
|
parallelism: 1
|
||||||
order: start-first
|
order: start-first
|
||||||
@@ -50,21 +43,18 @@ services:
|
|||||||
notify:
|
notify:
|
||||||
image: mathwave/sprint-repo:ruz-bot
|
image: mathwave/sprint-repo:ruz-bot
|
||||||
environment:
|
environment:
|
||||||
MONGO_HOST: "mongo.sprinthub.ru"
|
|
||||||
STAGE: "production"
|
STAGE: "production"
|
||||||
MONGO_PASSWORD: $MONGO_PASSWORD_PROD
|
MONGO_PASSWORD: $MONGO_PASSWORD_PROD
|
||||||
TELEGRAM_TOKEN: $TELEGRAM_TOKEN_PROD
|
|
||||||
PLATFORM_SECURITY_TOKEN: $PLATFORM_SECURITY_TOKEN
|
|
||||||
DEBUG: "false"
|
DEBUG: "false"
|
||||||
|
networks:
|
||||||
|
- queues
|
||||||
|
- configurator
|
||||||
|
- mongo
|
||||||
command: notify
|
command: notify
|
||||||
deploy:
|
deploy:
|
||||||
mode: replicated
|
mode: replicated
|
||||||
restart_policy:
|
restart_policy:
|
||||||
condition: any
|
condition: any
|
||||||
placement:
|
|
||||||
constraints:
|
|
||||||
# - node.role == worker
|
|
||||||
- node.labels.zone == ru
|
|
||||||
update_config:
|
update_config:
|
||||||
parallelism: 1
|
parallelism: 1
|
||||||
order: start-first
|
order: start-first
|
||||||
@@ -73,22 +63,17 @@ services:
|
|||||||
image: mathwave/sprint-repo:ruz-bot
|
image: mathwave/sprint-repo:ruz-bot
|
||||||
networks:
|
networks:
|
||||||
- common-infra-nginx
|
- common-infra-nginx
|
||||||
|
- configurator
|
||||||
|
- mongo
|
||||||
environment:
|
environment:
|
||||||
MONGO_HOST: "mongo.sprinthub.ru"
|
|
||||||
STAGE: "production"
|
STAGE: "production"
|
||||||
MONGO_PASSWORD: $MONGO_PASSWORD_PROD
|
MONGO_PASSWORD: $MONGO_PASSWORD_PROD
|
||||||
TELEGRAM_TOKEN: $TELEGRAM_TOKEN_PROD
|
|
||||||
PLATFORM_SECURITY_TOKEN: $PLATFORM_SECURITY_TOKEN
|
|
||||||
DEBUG: "false"
|
DEBUG: "false"
|
||||||
command: api
|
command: api
|
||||||
deploy:
|
deploy:
|
||||||
mode: replicated
|
mode: replicated
|
||||||
restart_policy:
|
restart_policy:
|
||||||
condition: any
|
condition: any
|
||||||
placement:
|
|
||||||
constraints:
|
|
||||||
# - node.role == worker
|
|
||||||
- node.labels.zone == ru
|
|
||||||
update_config:
|
update_config:
|
||||||
parallelism: 1
|
parallelism: 1
|
||||||
order: start-first
|
order: start-first
|
||||||
@@ -96,3 +81,9 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
common-infra-nginx:
|
common-infra-nginx:
|
||||||
external: true
|
external: true
|
||||||
|
queues:
|
||||||
|
external: true
|
||||||
|
configurator:
|
||||||
|
external: true
|
||||||
|
mongo:
|
||||||
|
external: true
|
||||||
|
|||||||
44
.gitea/workflows/deploy-dev.yaml
Normal file
44
.gitea/workflows/deploy-dev.yaml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
name: Deploy Dev
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
types: [closed]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: [ dev ]
|
||||||
|
steps:
|
||||||
|
- name: login
|
||||||
|
run: docker login -u mathwave -p ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: dev
|
||||||
|
- name: build
|
||||||
|
run: docker build -t mathwave/sprint-repo:ruz-bot .
|
||||||
|
push:
|
||||||
|
name: Push
|
||||||
|
runs-on: [ dev ]
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: push
|
||||||
|
run: docker push mathwave/sprint-repo:ruz-bot
|
||||||
|
deploy-dev:
|
||||||
|
name: Deploy dev
|
||||||
|
runs-on: [prod]
|
||||||
|
needs: push
|
||||||
|
steps:
|
||||||
|
- name: login
|
||||||
|
run: docker login -u mathwave -p ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: dev
|
||||||
|
- name: deploy
|
||||||
|
env:
|
||||||
|
TELEGRAM_TOKEN_DEV: ${{ secrets.TELEGRAM_TOKEN_DEV }}
|
||||||
|
MONGO_PASSWORD_DEV: ${{ secrets.MONGO_PASSWORD_DEV }}
|
||||||
|
run: docker stack deploy --with-registry-auth -c ./.deploy/deploy-dev.yaml ruz-bot-development
|
||||||
45
.gitea/workflows/deploy-prod.yaml
Normal file
45
.gitea/workflows/deploy-prod.yaml
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
name: Deploy Prod
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- prod
|
||||||
|
types: [closed]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: [ dev ]
|
||||||
|
steps:
|
||||||
|
- name: login
|
||||||
|
run: docker login -u mathwave -p ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: prod
|
||||||
|
- name: build
|
||||||
|
run: docker build -t mathwave/sprint-repo:ruz-bot .
|
||||||
|
push:
|
||||||
|
name: Push
|
||||||
|
runs-on: [ dev ]
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: push
|
||||||
|
run: docker push mathwave/sprint-repo:ruz-bot
|
||||||
|
deploy-prod:
|
||||||
|
name: Deploy prod
|
||||||
|
runs-on: [prod]
|
||||||
|
needs: push
|
||||||
|
steps:
|
||||||
|
- name: login
|
||||||
|
run: docker login -u mathwave -p ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: prod
|
||||||
|
- name: deploy
|
||||||
|
env:
|
||||||
|
TELEGRAM_TOKEN_PROD: ${{ secrets.TELEGRAM_TOKEN_PROD }}
|
||||||
|
MONGO_PASSWORD_PROD: ${{ secrets.MONGO_PASSWORD_PROD }}
|
||||||
|
PLATFORM_SECURITY_TOKEN: ${{ secrets.PLATFORM_SECURITY_TOKEN }}
|
||||||
|
run: docker stack deploy --with-registry-auth -c ./.deploy/deploy-prod.yaml ruz-bot
|
||||||
@@ -7,6 +7,7 @@ RUN apt-get install -y locales locales-all
|
|||||||
ENV LANGUAGE ru_RU.UTF-8
|
ENV LANGUAGE ru_RU.UTF-8
|
||||||
ENV LANG ru_RU.UTF-8
|
ENV LANG ru_RU.UTF-8
|
||||||
ENV LC_ALL ru_RU.UTF-8
|
ENV LC_ALL ru_RU.UTF-8
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
COPY requirements.txt requirements.txt
|
COPY requirements.txt requirements.txt
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install -r requirements.txt
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|||||||
@@ -3,9 +3,11 @@ from flask import Flask, request
|
|||||||
import settings
|
import settings
|
||||||
from helpers.alice import Processor
|
from helpers.alice import Processor
|
||||||
from helpers.mongo import mongo
|
from helpers.mongo import mongo
|
||||||
|
from daemons import base
|
||||||
|
|
||||||
|
|
||||||
def api():
|
class Daemon(base.Daemon):
|
||||||
|
def execute(self):
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@app.route('/stats/json', methods=['GET'])
|
@app.route('/stats/json', methods=['GET'])
|
||||||
|
|||||||
3
daemons/base.py
Normal file
3
daemons/base.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
class Daemon:
|
||||||
|
def execute(self):
|
||||||
|
raise NotImplementedError
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
import telebot
|
|
||||||
from telebot.types import Message
|
|
||||||
|
|
||||||
import settings
|
|
||||||
from helpers.mongo import mongo
|
|
||||||
from helpers.sprint_platform import platform
|
|
||||||
|
|
||||||
bot = telebot.TeleBot(os.getenv("TELEGRAM_TOKEN"))
|
|
||||||
|
|
||||||
|
|
||||||
@bot.message_handler(commands=['start'])
|
|
||||||
def on_start(message: Message):
|
|
||||||
mongo.users_collection.delete_many({"chat_id": message.chat.id})
|
|
||||||
do_action(message)
|
|
||||||
|
|
||||||
|
|
||||||
@bot.message_handler()
|
|
||||||
def do_action(message: Message):
|
|
||||||
if settings.STAGE == 'development' and not platform.is_staff(telegram_id=message.chat.id):
|
|
||||||
return
|
|
||||||
from helpers.answer import Answer
|
|
||||||
Answer(message).process()
|
|
||||||
@@ -6,6 +6,8 @@ from helpers import now, campus_timdelta
|
|||||||
from helpers.mongo import mongo
|
from helpers.mongo import mongo
|
||||||
from helpers.ruz import ruz
|
from helpers.ruz import ruz
|
||||||
|
|
||||||
|
from daemons import base
|
||||||
|
|
||||||
|
|
||||||
def fetch_schedule_for_user(user: dict):
|
def fetch_schedule_for_user(user: dict):
|
||||||
today = now(user)
|
today = now(user)
|
||||||
@@ -75,7 +77,8 @@ def delete_old():
|
|||||||
mongo.lessons_collection.delete_many({"end": {"$lte": datetime.datetime.now() - datetime.timedelta(days=1)}})
|
mongo.lessons_collection.delete_many({"end": {"$lte": datetime.datetime.now() - datetime.timedelta(days=1)}})
|
||||||
|
|
||||||
|
|
||||||
def fetch():
|
class Daemon(base.Daemon):
|
||||||
|
def execute(self):
|
||||||
while True:
|
while True:
|
||||||
logging.info("fetch start")
|
logging.info("fetch start")
|
||||||
begin = datetime.datetime.now()
|
begin = datetime.datetime.now()
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ import datetime
|
|||||||
import logging
|
import logging
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
from telebot.apihelper import ApiTelegramException
|
|
||||||
|
|
||||||
from daemons.bot import bot
|
|
||||||
from helpers import now
|
from helpers import now
|
||||||
from helpers.mongo import mongo
|
from helpers.mongo import mongo
|
||||||
from helpers.ruz import ruz
|
from helpers.ruz import ruz
|
||||||
|
from daemons import base
|
||||||
|
|
||||||
|
from utils import queues
|
||||||
|
|
||||||
|
|
||||||
def process():
|
def process():
|
||||||
@@ -25,13 +25,7 @@ def process():
|
|||||||
ans += f"🧑🏫 {(lesson['lecturer'] or 'Неизвестно')}\n"
|
ans += f"🧑🏫 {(lesson['lecturer'] or 'Неизвестно')}\n"
|
||||||
if lesson.get('link', None):
|
if lesson.get('link', None):
|
||||||
ans += f"🔗 {lesson['link']}"
|
ans += f"🔗 {lesson['link']}"
|
||||||
try:
|
queues.set_task('botalka_mailbox', {'project': 'ruz-bot', 'name': 'telegram-bot', 'body': {'text': f"Через {user['notify_minutes']} минут у тебя занятие!\n" + ans, 'chat_id': user["chat_id"], 'parse_mode': 'Markdown'}}, 1)
|
||||||
bot.send_message(
|
|
||||||
user["chat_id"],
|
|
||||||
f"Через {user['notify_minutes']} минут у тебя занятие!\n" + ans
|
|
||||||
)
|
|
||||||
except ApiTelegramException:
|
|
||||||
pass
|
|
||||||
mongo.lessons_collection.update_one({"_id": lesson['_id']}, {"$set": {"notified": True}})
|
mongo.lessons_collection.update_one({"_id": lesson['_id']}, {"$set": {"notified": True}})
|
||||||
time_now = datetime.datetime.now()
|
time_now = datetime.datetime.now()
|
||||||
for user in mongo.users_collection.find({"next_daily_notify_time": {"$lte": time_now}}):
|
for user in mongo.users_collection.find({"next_daily_notify_time": {"$lte": time_now}}):
|
||||||
@@ -46,11 +40,7 @@ def process():
|
|||||||
else:
|
else:
|
||||||
text = ruz.schedule_builder(lessons)
|
text = ruz.schedule_builder(lessons)
|
||||||
try:
|
try:
|
||||||
bot.send_message(
|
queues.set_task('botalka_mailbox', {'project': 'ruz-bot', 'name': 'telegram-bot', 'body': {'text': f"Уведомляю о занятиях! Твое расписание на {'сегодня' if user.get('daily_notify_today', True) else 'завтра'}:\n" + text, 'chat_id': user["chat_id"], 'parse_mode': 'Markdown'}}, 1)
|
||||||
user["chat_id"],
|
|
||||||
f"Уведомляю о занятиях! Твое расписание на {'сегодня' if user.get('daily_notify_today', True) else 'завтра'}:\n" + text,
|
|
||||||
parse_mode='Markdown'
|
|
||||||
)
|
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
mongo.users_collection.update_one(
|
mongo.users_collection.update_one(
|
||||||
@@ -72,7 +62,6 @@ def process():
|
|||||||
ans += f"🧑🏫 {(lesson['lecturer'] or 'Неизвестно')}\n"
|
ans += f"🧑🏫 {(lesson['lecturer'] or 'Неизвестно')}\n"
|
||||||
if lesson.get('link', None):
|
if lesson.get('link', None):
|
||||||
ans += f"🔗 {lesson['link']}"
|
ans += f"🔗 {lesson['link']}"
|
||||||
try:
|
|
||||||
mess = "Пары начутся через "
|
mess = "Пары начутся через "
|
||||||
if user['first_lesson_notify'] == 30:
|
if user['first_lesson_notify'] == 30:
|
||||||
mess += "30 минут"
|
mess += "30 минут"
|
||||||
@@ -83,18 +72,14 @@ def process():
|
|||||||
else:
|
else:
|
||||||
mess += "12 часов"
|
mess += "12 часов"
|
||||||
mess += "!\n\nТвоя первая пара:\n\n" + ans
|
mess += "!\n\nТвоя первая пара:\n\n" + ans
|
||||||
bot.send_message(
|
queues.set_task('botalka_mailbox', {'project': 'ruz-bot', 'name': 'telegram-bot', 'body': {'text': mess, 'chat_id': user["chat_id"], 'parse_mode': 'Markdown'}}, 1)
|
||||||
user["chat_id"],
|
|
||||||
mess
|
|
||||||
)
|
|
||||||
except ApiTelegramException:
|
|
||||||
pass
|
|
||||||
start_of_day = datetime.datetime(year=time_now.year, month=time_now.month, day=time_now.day)
|
start_of_day = datetime.datetime(year=time_now.year, month=time_now.month, day=time_now.day)
|
||||||
mongo.lessons_collection.update_many({"begin": {"$gte": start_of_day, "$lt": (start_of_day + datetime.timedelta(days=1))}, "user_email": user["email"]}, {"$set": {"notified_today": True}})
|
mongo.lessons_collection.update_many({"begin": {"$gte": start_of_day, "$lt": (start_of_day + datetime.timedelta(days=1))}, "user_email": user["email"]}, {"$set": {"notified_today": True}})
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
def notify():
|
class Daemon(base.Daemon):
|
||||||
|
def execute(self):
|
||||||
while True:
|
while True:
|
||||||
logging.info("notify start")
|
logging.info("notify start")
|
||||||
begin = datetime.datetime.now()
|
begin = datetime.datetime.now()
|
||||||
|
|||||||
19
daemons/worker.py
Normal file
19
daemons/worker.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
from daemons import base
|
||||||
|
from utils import queues
|
||||||
|
import json
|
||||||
|
|
||||||
|
from telebot.types import Message
|
||||||
|
|
||||||
|
|
||||||
|
class Daemon(base.Daemon, queues.TasksHandlerMixin):
|
||||||
|
@property
|
||||||
|
def queue_name(self):
|
||||||
|
return 'ruz_bot_worker'
|
||||||
|
|
||||||
|
def execute(self):
|
||||||
|
self.poll()
|
||||||
|
|
||||||
|
def process(self, payload):
|
||||||
|
message: Message = Message.de_json(json.dumps(payload))
|
||||||
|
from helpers.answer import Answer
|
||||||
|
Answer(message).process()
|
||||||
@@ -2,10 +2,6 @@ import logging.config
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import settings
|
import settings
|
||||||
from daemons.api import api
|
|
||||||
from daemons.bot import bot
|
|
||||||
from daemons.fetch import fetch
|
|
||||||
from daemons.notify import notify
|
|
||||||
import locale
|
import locale
|
||||||
|
|
||||||
|
|
||||||
@@ -13,17 +9,25 @@ logging.config.dictConfig(settings.logging_config)
|
|||||||
locale.setlocale(locale.LC_TIME, 'ru_RU.UTF-8')
|
locale.setlocale(locale.LC_TIME, 'ru_RU.UTF-8')
|
||||||
arg = sys.argv[-1]
|
arg = sys.argv[-1]
|
||||||
|
|
||||||
if arg == "bot":
|
if arg == "poll":
|
||||||
logging.info("bot is starting")
|
logging.info("poll is starting")
|
||||||
bot.polling()
|
from daemons.poll import Daemon
|
||||||
|
elif arg == 'worker':
|
||||||
|
logging.info("worker is starting")
|
||||||
|
from daemons.worker import Daemon
|
||||||
|
elif arg == 'mailbox':
|
||||||
|
logging.info("mailbox is starting")
|
||||||
|
from daemons.mailbox import Daemon
|
||||||
elif arg == "fetch":
|
elif arg == "fetch":
|
||||||
logging.info("fetch is starting")
|
logging.info("fetch is starting")
|
||||||
fetch()
|
from daemons.fetch import Daemon
|
||||||
elif arg == "notify":
|
elif arg == "notify":
|
||||||
logging.info("notify is starting")
|
logging.info("notify is starting")
|
||||||
notify()
|
from daemons.notify import Daemon
|
||||||
elif arg == "api":
|
elif arg == "api":
|
||||||
logging.info("api is starting")
|
logging.info("api is starting")
|
||||||
api()
|
from daemons.api import Daemon
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Unknown param {arg}")
|
raise ValueError(f"Unknown param {arg}")
|
||||||
|
|
||||||
|
Daemon().execute()
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import logging
|
import logging
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from daemons.bot import bot
|
|
||||||
from helpers import now
|
from helpers import now
|
||||||
from helpers.mongo import mongo
|
from helpers.mongo import mongo
|
||||||
|
from utils import queues
|
||||||
|
|
||||||
|
|
||||||
def try_parse(message: str) -> Optional[int]:
|
def try_parse(message: str) -> Optional[int]:
|
||||||
@@ -84,7 +84,7 @@ class Processor:
|
|||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
mongo.users_collection.update_one({"yandex_code": code}, {"$set": {"yandex_id": self.user_id, "yandex_code": None}})
|
mongo.users_collection.update_one({"yandex_code": code}, {"$set": {"yandex_id": self.user_id, "yandex_code": None}})
|
||||||
bot.send_message(user['chat_id'], "Алиса успешно подключена!")
|
queues.set_task('ruz_bot_mailbox', {'text': "Алиса успешно подключена!", 'chat_id': user["chat_id"]}, 1)
|
||||||
lesson = self.get_lesson_for_user(user['chat_id'])
|
lesson = self.get_lesson_for_user(user['chat_id'])
|
||||||
if lesson is None:
|
if lesson is None:
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import datetime
|
import datetime
|
||||||
|
import logging
|
||||||
from random import choice
|
from random import choice
|
||||||
|
|
||||||
from telebot.types import Message, ReplyKeyboardRemove
|
from telebot.types import Message, ReplyKeyboardRemove
|
||||||
|
|
||||||
from daemons.bot import bot
|
|
||||||
from daemons.fetch import fetch_schedule_for_user
|
from daemons.fetch import fetch_schedule_for_user
|
||||||
from helpers import get_next_daily_notify_time
|
from helpers import get_next_daily_notify_time
|
||||||
from helpers.keyboards import main_keyboard, notify_keyboard, yes_no_keyboard, again_keyboard, no_daily_notify, \
|
from helpers.keyboards import main_keyboard, notify_keyboard, yes_no_keyboard, again_keyboard, no_daily_notify, \
|
||||||
@@ -11,6 +11,16 @@ from helpers.keyboards import main_keyboard, notify_keyboard, yes_no_keyboard, a
|
|||||||
from helpers.mongo import mongo
|
from helpers.mongo import mongo
|
||||||
from helpers.sprint_platform import platform
|
from helpers.sprint_platform import platform
|
||||||
from helpers.ruz import ruz
|
from helpers.ruz import ruz
|
||||||
|
from utils import queues
|
||||||
|
|
||||||
|
|
||||||
|
class User:
|
||||||
|
def __init__(self, telegram_id):
|
||||||
|
self.telegram_id = telegram_id
|
||||||
|
|
||||||
|
@property
|
||||||
|
def platform_staff(self):
|
||||||
|
return platform.is_staff(telegram_id=self.telegram_id)
|
||||||
|
|
||||||
|
|
||||||
class Answer:
|
class Answer:
|
||||||
@@ -20,9 +30,10 @@ class Answer:
|
|||||||
message_text: str
|
message_text: str
|
||||||
|
|
||||||
def __init__(self, message: Message):
|
def __init__(self, message: Message):
|
||||||
self.message = message
|
|
||||||
self.message = message
|
self.message = message
|
||||||
self.message_text = message.text or message.caption or ""
|
self.message_text = message.text or message.caption or ""
|
||||||
|
if self.message_text.startswith('/start'):
|
||||||
|
mongo.users_collection.delete_many({"chat_id": message.chat.id})
|
||||||
user = mongo.users_collection.find_one({"chat_id": message.chat.id})
|
user = mongo.users_collection.find_one({"chat_id": message.chat.id})
|
||||||
if user is None:
|
if user is None:
|
||||||
user = {
|
user = {
|
||||||
@@ -43,6 +54,7 @@ class Answer:
|
|||||||
self.user = user
|
self.user = user
|
||||||
|
|
||||||
def process(self):
|
def process(self):
|
||||||
|
user = User(self.user['chat_id'])
|
||||||
getattr(
|
getattr(
|
||||||
self,
|
self,
|
||||||
"handle_state_" + self.user['state'],
|
"handle_state_" + self.user['state'],
|
||||||
@@ -55,7 +67,10 @@ class Answer:
|
|||||||
def send_message(self, text, reply_markup=None, remove_keyboard=True, **kwargs):
|
def send_message(self, text, reply_markup=None, remove_keyboard=True, **kwargs):
|
||||||
if reply_markup is None and remove_keyboard:
|
if reply_markup is None and remove_keyboard:
|
||||||
reply_markup = ReplyKeyboardRemove()
|
reply_markup = ReplyKeyboardRemove()
|
||||||
bot.send_message(self.user['chat_id'], text, reply_markup=reply_markup, **kwargs)
|
body = {'text': text, 'chat_id': self.user['chat_id'], 'parse_mode': 'Markdown'}
|
||||||
|
if reply_markup:
|
||||||
|
body['reply_markup'] = reply_markup.to_json()
|
||||||
|
queues.set_task('botalka_mailbox', {'project': 'ruz-bot', 'name': 'telegram-bot', 'body': body}, 5)
|
||||||
|
|
||||||
def set_state(self, state: str):
|
def set_state(self, state: str):
|
||||||
self.user['state'] = state
|
self.user['state'] = state
|
||||||
@@ -145,6 +160,21 @@ class Answer:
|
|||||||
self.set_state("reset")
|
self.set_state("reset")
|
||||||
return
|
return
|
||||||
elif self.message_text == "Подключение Алисы":
|
elif self.message_text == "Подключение Алисы":
|
||||||
|
alice_exp = platform.get_experiment('alice')
|
||||||
|
telegram_id = self.user['chat_id']
|
||||||
|
try:
|
||||||
|
user = User(telegram_id)
|
||||||
|
alice_exp_enabled = alice_exp['enabled'] and eval(alice_exp['condition'])
|
||||||
|
except Exception as exc:
|
||||||
|
logging.info(exc)
|
||||||
|
alice_exp_enabled = False
|
||||||
|
if not alice_exp_enabled:
|
||||||
|
self.send_message(
|
||||||
|
'Эта функция еще не работает!',
|
||||||
|
reply_markup=main_keyboard(self.user['chat_id']),
|
||||||
|
parse_mode='Markdown'
|
||||||
|
)
|
||||||
|
return
|
||||||
if self.user.get('yandex_id', None) is None:
|
if self.user.get('yandex_id', None) is None:
|
||||||
words = platform.get_config('words')
|
words = platform.get_config('words')
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
@@ -13,12 +13,7 @@ def main_keyboard(telegram_id):
|
|||||||
kb.row("Ежедневные уведомления")
|
kb.row("Ежедневные уведомления")
|
||||||
alice_exp = platform.get_experiment('alice')
|
alice_exp = platform.get_experiment('alice')
|
||||||
try:
|
try:
|
||||||
class User:
|
from helpers.answer import User
|
||||||
def __init__(self, telegram_id):
|
|
||||||
self.telegram_id = telegram_id
|
|
||||||
@property
|
|
||||||
def platform_staff(self):
|
|
||||||
return platform.is_staff(telegram_id=self.telegram_id)
|
|
||||||
user = User(telegram_id)
|
user = User(telegram_id)
|
||||||
alice_exp_enabled = alice_exp['enabled'] and eval(alice_exp['condition'])
|
alice_exp_enabled = alice_exp['enabled'] and eval(alice_exp['condition'])
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from helpers import now
|
|||||||
|
|
||||||
class Mongo:
|
class Mongo:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
url = f"mongodb://{settings.MONGO_USER}:{settings.MONGO_PASSWORD}@{settings.MONGO_HOST}:27017/"
|
url = f"mongodb://{settings.MONGO_USER}:{settings.MONGO_PASSWORD}@mongo:27017/"
|
||||||
self.client = pymongo.MongoClient(url)
|
self.client = pymongo.MongoClient(url)
|
||||||
self.database = self.client.get_database("ruz-bot")
|
self.database = self.client.get_database("ruz-bot")
|
||||||
self.users_collection.create_index([
|
self.users_collection.create_index([
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ fields = [
|
|||||||
'date_start',
|
'date_start',
|
||||||
'date_end',
|
'date_end',
|
||||||
'lecturer_profiles',
|
'lecturer_profiles',
|
||||||
'stream_links'
|
'stream_links',
|
||||||
|
'type',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ class RUZ:
|
|||||||
del data['stream_links']
|
del data['stream_links']
|
||||||
|
|
||||||
def get_schedule(self, user: dict, begin_date: datetime.datetime):
|
def get_schedule(self, user: dict, begin_date: datetime.datetime):
|
||||||
start_date_str = begin_date.strftime("%Y.%m.%d")
|
start_date_str = begin_date.strftime("%Y-%m-%d")
|
||||||
search_str = settings.RUZ_API + f"v3/ruz/lessons?start={start_date_str}&offset=30&email={user['email']}"
|
search_str = settings.RUZ_API + f"v3/ruz/lessons?start={start_date_str}&offset=30&email={user['email']}"
|
||||||
try:
|
try:
|
||||||
data = get(search_str)
|
data = get(search_str)
|
||||||
|
|||||||
@@ -15,13 +15,11 @@ class PlatformClient:
|
|||||||
self.stage = stage
|
self.stage = stage
|
||||||
self.configs = configs
|
self.configs = configs
|
||||||
self.experiments = experiments
|
self.experiments = experiments
|
||||||
self.endpoint = 'https://platform.sprinthub.ru/'
|
self.endpoint = 'http://configurator/'
|
||||||
self.configs_url = urllib.parse.urljoin(self.endpoint, 'configs/get')
|
self.fetch_url = urllib.parse.urljoin(self.endpoint, '/api/v1/fetch')
|
||||||
self.experiments_url = urllib.parse.urljoin(self.endpoint, 'experiments/get')
|
|
||||||
self.staff_url = urllib.parse.urljoin(self.endpoint, 'is_staff')
|
|
||||||
self.fetch_url = urllib.parse.urljoin(self.endpoint, 'fetch')
|
|
||||||
self.config_storage = {}
|
self.config_storage = {}
|
||||||
self.experiment_storage = {}
|
self.experiment_storage = {}
|
||||||
|
self.staff_storage = {}
|
||||||
self.poll_data()
|
self.poll_data()
|
||||||
if need_poll:
|
if need_poll:
|
||||||
self.poll_data_in_thread()
|
self.poll_data_in_thread()
|
||||||
@@ -32,7 +30,7 @@ class PlatformClient:
|
|||||||
sleep(30)
|
sleep(30)
|
||||||
self.fetch()
|
self.fetch()
|
||||||
|
|
||||||
Thread(target=inner).start()
|
Thread(target=inner, daemon=True).start()
|
||||||
|
|
||||||
def poll_data(self):
|
def poll_data(self):
|
||||||
self.fetch(with_exception=True)
|
self.fetch(with_exception=True)
|
||||||
@@ -43,7 +41,6 @@ class PlatformClient:
|
|||||||
try:
|
try:
|
||||||
response = get(
|
response = get(
|
||||||
url,
|
url,
|
||||||
headers={'X-Security-Token': self.platform_security_token},
|
|
||||||
params=params
|
params=params
|
||||||
)
|
)
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
@@ -63,6 +60,10 @@ class PlatformClient:
|
|||||||
local_platform = json.loads(open('local_platform.json', 'r').read())
|
local_platform = json.loads(open('local_platform.json', 'r').read())
|
||||||
self.config_storage = local_platform['configs']
|
self.config_storage = local_platform['configs']
|
||||||
self.experiment_storage = local_platform['experiments']
|
self.experiment_storage = local_platform['experiments']
|
||||||
|
self.staff_storage = {
|
||||||
|
key: set(value)
|
||||||
|
for key, value in local_platform['platform_staff'].items()
|
||||||
|
}
|
||||||
return
|
return
|
||||||
response_data = self.request_with_retries(self.fetch_url, {
|
response_data = self.request_with_retries(self.fetch_url, {
|
||||||
'project': self.app_name,
|
'project': self.app_name,
|
||||||
@@ -70,6 +71,10 @@ class PlatformClient:
|
|||||||
}, with_exception)
|
}, with_exception)
|
||||||
self.config_storage = response_data['configs']
|
self.config_storage = response_data['configs']
|
||||||
self.experiment_storage = response_data['experiments']
|
self.experiment_storage = response_data['experiments']
|
||||||
|
self.staff_storage = {
|
||||||
|
key: set(value)
|
||||||
|
for key, value in response_data['platform_staff'].items()
|
||||||
|
}
|
||||||
|
|
||||||
def fetch_configs(self, with_exception=False):
|
def fetch_configs(self, with_exception=False):
|
||||||
if self.stage == 'local':
|
if self.stage == 'local':
|
||||||
@@ -98,18 +103,10 @@ class PlatformClient:
|
|||||||
self.experiment_storage[experiment] = response_data
|
self.experiment_storage[experiment] = response_data
|
||||||
|
|
||||||
def is_staff(self, **kwargs):
|
def is_staff(self, **kwargs):
|
||||||
if self.stage == 'local':
|
|
||||||
local_platform = json.loads(open('local_platform.json', 'r').read())
|
|
||||||
local_staff = local_platform['staff']
|
|
||||||
for element in local_staff:
|
|
||||||
for key, value in kwargs.items():
|
for key, value in kwargs.items():
|
||||||
if element[key] == value:
|
if value in self.staff_storage[key]:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
response_data = self.request_with_retries(self.staff_url, kwargs)
|
|
||||||
if response_data is None:
|
|
||||||
return False
|
|
||||||
return response_data['is_staff']
|
|
||||||
|
|
||||||
def get_config(self, name):
|
def get_config(self, name):
|
||||||
return self.config_storage[name]
|
return self.config_storage[name]
|
||||||
|
|||||||
0
utils/__init__.py
Normal file
0
utils/__init__.py
Normal file
87
utils/queues.py
Normal file
87
utils/queues.py
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
|
import datetime
|
||||||
|
import os
|
||||||
|
import traceback
|
||||||
|
import zoneinfo
|
||||||
|
import requests
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
stage = os.getenv("STAGE", 'local')
|
||||||
|
if stage == 'local':
|
||||||
|
QUEUES_URL = 'http://localhost:1239'
|
||||||
|
else:
|
||||||
|
QUEUES_URL = 'http://queues:1239'
|
||||||
|
|
||||||
|
|
||||||
|
class QueuesException(Exception):
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
class TasksHandlerMixin:
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
self.executor = ThreadPoolExecutor(max_workers=1)
|
||||||
|
|
||||||
|
def _send_metric(self, start: datetime.datetime, end: datetime.datetime, success: bool):
|
||||||
|
def send():
|
||||||
|
requests.post(f'{QUEUES_URL}/api/v1/metric', json={
|
||||||
|
'service': 'ruz-bot',
|
||||||
|
'queue': self.queue_name,
|
||||||
|
'success': success,
|
||||||
|
'timestamp': start.strftime("%Y-%m-%dT%H:%M:%S") + "Z",
|
||||||
|
"success": success,
|
||||||
|
"execution_time_ms": (end - start).microseconds // 1000,
|
||||||
|
"environment": stage,
|
||||||
|
})
|
||||||
|
|
||||||
|
self.executor.submit(send)
|
||||||
|
|
||||||
|
def poll(self):
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
response = requests.get(f'{QUEUES_URL}/api/v1/take', headers={'queue': self.queue_name}).json()
|
||||||
|
except requests.JSONDecodeError:
|
||||||
|
print('Unable to decode json')
|
||||||
|
time.sleep(3)
|
||||||
|
continue
|
||||||
|
task = response.get('task')
|
||||||
|
if not task:
|
||||||
|
time.sleep(0.2)
|
||||||
|
continue
|
||||||
|
start = datetime.datetime.now(zoneinfo.ZoneInfo("Europe/Moscow"))
|
||||||
|
try:
|
||||||
|
print(f'process task with id {task["id"]}, attempt {task["attempt"]}')
|
||||||
|
self.process(task['payload'])
|
||||||
|
success = True
|
||||||
|
except Exception as exc:
|
||||||
|
print(f'Error processing message id={task["id"]}, payload={task["payload"]}, exc={exc}')
|
||||||
|
traceback.print_exc()
|
||||||
|
success = False
|
||||||
|
end = datetime.datetime.now(zoneinfo.ZoneInfo("Europe/Moscow"))
|
||||||
|
if success:
|
||||||
|
try:
|
||||||
|
resp = requests.post(f'{QUEUES_URL}/api/v1/finish', json={'id': task['id']})
|
||||||
|
if resp.status_code != 202:
|
||||||
|
raise QueuesException
|
||||||
|
print(f'finish task with id {task["id"]}')
|
||||||
|
except:
|
||||||
|
print(f'Failed to finish task id={task["id"]}')
|
||||||
|
self._send_metric(start, end, success)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def queue_name(self):
|
||||||
|
raise NotImplemented
|
||||||
|
|
||||||
|
def process(self, payload):
|
||||||
|
raise NotImplemented
|
||||||
|
|
||||||
|
|
||||||
|
def set_task(queue_name: str, payload: dict, seconds_to_execute: int, delay: int|None = None):
|
||||||
|
resp = requests.post(f'{QUEUES_URL}/api/v1/put', headers={'queue': queue_name}, json={
|
||||||
|
'payload': payload,
|
||||||
|
'seconds_to_execute': seconds_to_execute,
|
||||||
|
'delay': delay,
|
||||||
|
})
|
||||||
|
if resp.status_code != 202:
|
||||||
|
raise QueuesException
|
||||||
Reference in New Issue
Block a user