feat(notifications): add redis-backed sse notification streaming
This commit is contained in:
@@ -45,6 +45,7 @@ LOCAL_APPS = [
|
||||
"apps.projects",
|
||||
"apps.tags",
|
||||
"apps.time_entries",
|
||||
"apps.notifications",
|
||||
]
|
||||
|
||||
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
|
||||
@@ -202,10 +203,35 @@ CELERY_ACCEPT_CONTENT = ["json"]
|
||||
CELERY_TASK_SERIALIZER = "json"
|
||||
CELERY_RESULT_SERIALIZER = "json"
|
||||
CELERY_TASK_ALWAYS_EAGER = False
|
||||
CELERY_IMPORTS = ("apps.users.tasks",)
|
||||
CELERY_TIMEZONE = os.getenv("TIME_ZONE")
|
||||
CELERY_TASK_TRACK_STARTED = True
|
||||
|
||||
NOTIFICATIONS_ENABLED = os.getenv("NOTIFICATIONS_ENABLED", "True") == "True"
|
||||
NOTIFICATION_STREAM_TOKEN_LIFETIME_SECONDS = int(
|
||||
os.getenv("NOTIFICATION_STREAM_TOKEN_LIFETIME_SECONDS", "90")
|
||||
)
|
||||
NOTIFICATION_SSE_HEARTBEAT_SECONDS = int(
|
||||
os.getenv("NOTIFICATION_SSE_HEARTBEAT_SECONDS", "20")
|
||||
)
|
||||
NOTIFICATION_SSE_RETRY_MS = int(os.getenv("NOTIFICATION_SSE_RETRY_MS", "5000"))
|
||||
NOTIFICATION_DEFAULT_PAGE_SIZE = int(
|
||||
os.getenv("NOTIFICATION_DEFAULT_PAGE_SIZE", "20")
|
||||
)
|
||||
NOTIFICATION_MAX_PAGE_SIZE = int(os.getenv("NOTIFICATION_MAX_PAGE_SIZE", "50"))
|
||||
NOTIFICATION_REDIS_CHANNEL_PREFIX = os.getenv(
|
||||
"NOTIFICATION_REDIS_CHANNEL_PREFIX", "notif:user"
|
||||
)
|
||||
NOTIFICATION_RETENTION_DAYS = int(os.getenv("NOTIFICATION_RETENTION_DAYS", "30"))
|
||||
NOTIFICATION_TOAST_LEVELS = tuple(
|
||||
level.strip()
|
||||
for level in os.getenv(
|
||||
"NOTIFICATION_TOAST_LEVELS", "info,success,warning,error"
|
||||
).split(",")
|
||||
if level.strip()
|
||||
)
|
||||
|
||||
CELERY_IMPORTS = ("apps.users.tasks", "apps.notifications.tasks")
|
||||
|
||||
|
||||
STORAGES = {
|
||||
"default": {"BACKEND": "django.core.files.storage.FileSystemStorage"},
|
||||
|
||||
@@ -21,6 +21,7 @@ urlpatterns = [
|
||||
path('api/', include('apps.projects.api.urls'), name="projects"),
|
||||
path('api/', include('apps.tags.api.urls'), name="tags"),
|
||||
path('api/', include('apps.time_entries.api.urls'), name="time_entries"),
|
||||
path("api/notifications/", include("apps.notifications.urls"), name="notifications"),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
|
||||
Reference in New Issue
Block a user