summaryrefslogtreecommitdiffstats
path: root/stator
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-20 14:20:28 -0700
committerAndrew Godwin2022-11-20 14:20:28 -0700
commit6e88c0096942e008bb55d29b5696a058a2c1e013 (patch)
tree44ced82afa145b2dbeb8171d51998231d09607e1 /stator
parent70d01bf1b4f44c48fa8af524ff7d73b485d62dc2 (diff)
downloadtakahe-6e88c0096942e008bb55d29b5696a058a2c1e013.tar.gz
takahe-6e88c0096942e008bb55d29b5696a058a2c1e013.tar.bz2
takahe-6e88c0096942e008bb55d29b5696a058a2c1e013.zip
Don't waste DB rows on bad inbox actors
Seems Sidekiq will keep trying to deliver messages even when the actor no longer exists?
Diffstat (limited to 'stator')
-rw-r--r--stator/models.py7
-rw-r--r--stator/runner.py8
2 files changed, 4 insertions, 11 deletions
diff --git a/stator/models.py b/stator/models.py
index 426803a..bbff395 100644
--- a/stator/models.py
+++ b/stator/models.py
@@ -4,11 +4,11 @@ import traceback
from typing import ClassVar, List, Optional, Type, Union, cast
from asgiref.sync import sync_to_async
-from django.conf import settings
from django.db import models, transaction
from django.utils import timezone
from django.utils.functional import classproperty
+from core import exceptions
from stator.graph import State, StateGraph
@@ -155,10 +155,7 @@ class StatorModel(models.Model):
next_state = await current_state.handler(self)
except BaseException as e:
await StatorError.acreate_from_instance(self, e)
- if settings.SENTRY_ENABLED:
- from sentry_sdk import capture_exception
-
- await sync_to_async(capture_exception, thread_sensitive=False)(e)
+ await exceptions.acapture_exception(e)
traceback.print_exc()
else:
if next_state:
diff --git a/stator/runner.py b/stator/runner.py
index 7daf921..21c6128 100644
--- a/stator/runner.py
+++ b/stator/runner.py
@@ -5,10 +5,9 @@ import traceback
import uuid
from typing import List, Optional, Type
-from asgiref.sync import sync_to_async
-from django.conf import settings
from django.utils import timezone
+from core import exceptions
from stator.models import StatorModel
@@ -93,10 +92,7 @@ class StatorRunner:
)
await instance.atransition_attempt()
except BaseException as e:
- if settings.SENTRY_ENABLED:
- from sentry_sdk import capture_exception
-
- await sync_to_async(capture_exception, thread_sensitive=False)(e)
+ await exceptions.acapture_exception(e)
traceback.print_exc()
def remove_completed_tasks(self):