~fabrixxm/activist

0ecc8ceafb62b861ae3a58b89a208cae50c9aa9a — fabrixxm a month ago d8340d5
Spelling
2 files changed, 4 insertions(+), 4 deletions(-)

M activist/background.py
M activist/tasks.py
M activist/background.py => activist/background.py +2 -2
@@ 13,7 13,7 @@ from .config import settings
logger = logging.getLogger(__name__)


class UrecoverableBacgroundTaskException(Exception):
class UrecoverableBackgroundTaskException(Exception):
    "Raising this exception from a task cause task to fail directly without retry"
    pass



@@ 106,7 106,7 @@ class TaskType:
            self._set_state("failed")
            return
        
        if isinstance(e, UrecoverableBacgroundTaskException):
        if isinstance(e, UrecoverableBackgroundTaskException):
            logger.info("task failed and requested to be dequeued")
            self._set_state("failed")
            return

M activist/tasks.py => activist/tasks.py +2 -2
@@ 6,7 6,7 @@ import json
import logging
import datetime
from typing import Optional
from .background import background, UrecoverableBacgroundTaskException
from .background import background, UrecoverableBackgroundTaskException
from .activitystream import AS_PUBLIC, ACTORS
from .config import settings
from . import activitypub


@@ 25,7 25,7 @@ def publish(obj_id:str):
    logger.debug("publish post %r", obj_id)
    asobj = db.Object.get(obj_id)
    if asobj is None:
        raise UrecoverableBacgroundTaskException(f"Publish Task. Object not found '{obj_id}'")
        raise UrecoverableBackgroundTaskException(f"Publish Task. Object not found '{obj_id}'")
    obj = asobj.data
    recipients = []
    for prop in [ "to", "bto", "cc", "bcc", "audience" ]: