Compare commits
No commits in common. "da4dddbcf709998d20c5e645b766d3b3983d18c9" and "8570dda2119efd84759542203511e2cab86f382e" have entirely different histories.
da4dddbcf7
...
8570dda211
|
@ -4,9 +4,6 @@ from app.models.task import Task
|
||||||
def success_state(task_id):
|
def success_state(task_id):
|
||||||
task = Task.query.get(task_id)
|
task = Task.query.get(task_id)
|
||||||
|
|
||||||
if not task:
|
|
||||||
return
|
|
||||||
|
|
||||||
task.status = "SUCCESS"
|
task.status = "SUCCESS"
|
||||||
task.status_message = "задача выполнена успешно"
|
task.status_message = "задача выполнена успешно"
|
||||||
|
|
||||||
|
@ -15,9 +12,6 @@ def success_state(task_id):
|
||||||
def failure_state(task_id, exception):
|
def failure_state(task_id, exception):
|
||||||
task = Task.query.get(task_id)
|
task = Task.query.get(task_id)
|
||||||
|
|
||||||
if not task:
|
|
||||||
return
|
|
||||||
|
|
||||||
task.status = "FAILURE"
|
task.status = "FAILURE"
|
||||||
task.status_message = f"произошла ошибка {str(exception)}"
|
task.status_message = f"произошла ошибка {str(exception)}"
|
||||||
|
|
||||||
|
@ -26,9 +20,6 @@ def failure_state(task_id, exception):
|
||||||
def run_state(task_id, task_record_id):
|
def run_state(task_id, task_record_id):
|
||||||
task = Task.query.get(task_record_id)
|
task = Task.query.get(task_record_id)
|
||||||
|
|
||||||
if not task:
|
|
||||||
return
|
|
||||||
|
|
||||||
task.task_id = task_id
|
task.task_id = task_id
|
||||||
task.status = "RUNNING"
|
task.status = "RUNNING"
|
||||||
task.status_message = "задача запущена"
|
task.status_message = "задача запущена"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
from sqlalchemy import Integer, false, null
|
from sqlalchemy import Integer, null
|
||||||
from sqlalchemy.schema import (
|
from sqlalchemy.schema import (
|
||||||
Column,
|
Column,
|
||||||
ForeignKey,
|
ForeignKey,
|
||||||
|
@ -16,7 +16,7 @@ class User(db.Model):
|
||||||
username: Mapped[str] = mapped_column(nullable=True)
|
username: Mapped[str] = mapped_column(nullable=True)
|
||||||
description: Mapped[str] = mapped_column(nullable=True)
|
description: Mapped[str] = mapped_column(nullable=True)
|
||||||
|
|
||||||
delete: Mapped[bool] = mapped_column(default=false)
|
delete: Mapped[bool] = mapped_column(default="false")
|
||||||
|
|
||||||
collection_id = Column(Integer, ForeignKey("collection.id"))
|
collection_id = Column(Integer, ForeignKey("collection.id"))
|
||||||
collection: Mapped["Collection"] = relationship("Collection", back_populates="users")
|
collection: Mapped["Collection"] = relationship("Collection", back_populates="users")
|
||||||
|
|
|
@ -66,7 +66,7 @@ class PaperClient(TelegramClient):
|
||||||
except (PeerFloodError, FloodWaitError) as e:
|
except (PeerFloodError, FloodWaitError) as e:
|
||||||
raise FloodException(e)
|
raise FloodException(e)
|
||||||
|
|
||||||
except (UserChannelsTooMuchError, UsersTooMuchError, UserIsBlockedError, YouBlockedUserError, ValueError, UserKickedError, UsernameInvalidError) as e:
|
except (UserChannelsTooMuchError, UsersTooMuchError, UserIsBlockedError, YouBlockedUserError, UserKickedError, UsernameInvalidError) as e:
|
||||||
raise IgnoreException(e)
|
raise IgnoreException(e)
|
||||||
|
|
||||||
@logger.catch(reraise=True)
|
@logger.catch(reraise=True)
|
||||||
|
|
|
@ -25,7 +25,7 @@ class PaperParser:
|
||||||
for user in users:
|
for user in users:
|
||||||
try:
|
try:
|
||||||
if task.is_aborted():
|
if task.is_aborted():
|
||||||
return
|
return self.users_to_delete
|
||||||
|
|
||||||
await self.client.invite_user(user, group)
|
await self.client.invite_user(user, group)
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class PaperParser:
|
||||||
for user in users:
|
for user in users:
|
||||||
try:
|
try:
|
||||||
if task.is_aborted():
|
if task.is_aborted():
|
||||||
return
|
return self.users_to_delete
|
||||||
|
|
||||||
await self.client.send_message(user, message, file)
|
await self.client.send_message(user, message, file)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue