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):
|
||||
task = Task.query.get(task_id)
|
||||
|
||||
if not task:
|
||||
return
|
||||
|
||||
task.status = "SUCCESS"
|
||||
task.status_message = "задача выполнена успешно"
|
||||
|
||||
|
@ -15,9 +12,6 @@ def success_state(task_id):
|
|||
def failure_state(task_id, exception):
|
||||
task = Task.query.get(task_id)
|
||||
|
||||
if not task:
|
||||
return
|
||||
|
||||
task.status = "FAILURE"
|
||||
task.status_message = f"произошла ошибка {str(exception)}"
|
||||
|
||||
|
@ -26,9 +20,6 @@ def failure_state(task_id, exception):
|
|||
def run_state(task_id, task_record_id):
|
||||
task = Task.query.get(task_record_id)
|
||||
|
||||
if not task:
|
||||
return
|
||||
|
||||
task.task_id = task_id
|
||||
task.status = "RUNNING"
|
||||
task.status_message = "задача запущена"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
from sqlalchemy import Integer, false, null
|
||||
from sqlalchemy import Integer, null
|
||||
from sqlalchemy.schema import (
|
||||
Column,
|
||||
ForeignKey,
|
||||
|
@ -16,7 +16,7 @@ class User(db.Model):
|
|||
username: 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: Mapped["Collection"] = relationship("Collection", back_populates="users")
|
||||
|
|
|
@ -66,7 +66,7 @@ class PaperClient(TelegramClient):
|
|||
except (PeerFloodError, FloodWaitError) as 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)
|
||||
|
||||
@logger.catch(reraise=True)
|
||||
|
|
|
@ -25,8 +25,8 @@ class PaperParser:
|
|||
for user in users:
|
||||
try:
|
||||
if task.is_aborted():
|
||||
return
|
||||
|
||||
return self.users_to_delete
|
||||
|
||||
await self.client.invite_user(user, group)
|
||||
|
||||
except (UserPrivacyException, IgnoreException):
|
||||
|
@ -50,7 +50,7 @@ class PaperParser:
|
|||
for user in users:
|
||||
try:
|
||||
if task.is_aborted():
|
||||
return
|
||||
return self.users_to_delete
|
||||
|
||||
await self.client.send_message(user, message, file)
|
||||
|
||||
|
|
Loading…
Reference in New Issue