Skip to content

Commit

Permalink
Remove django-database-locks dependency (#24)
Browse files Browse the repository at this point in the history
* Remove django-database-locks dependency

This dependency assumes too much on the implementation of the platform.
The recommendation is to do a subclass of the notification_sender command
with any necessary locking mechanism (which can be the django-database-locks)
  • Loading branch information
DDuarte authored Jul 16, 2024
1 parent aeeda2b commit 70d788f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
6 changes: 2 additions & 4 deletions notifications/management/commands/notification_sender.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import json
import logging
import time

from pathlib import Path

from django.conf import settings
from django.core.mail import EmailMultiAlternatives, get_connection
from django.core.management import BaseCommand
from slack_sdk import WebClient, errors

from database_locks import locked
from notifications.models import Notification, Subscription
from django.conf import settings

logger = logging.getLogger(__name__)


@locked
class Command(BaseCommand):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ packages = find:
python_requires = >=3.9
install_requires =
Django >= 4.2, <6.0
django-database-locks < 1
# tested with 2.3.0 and 3.0.0
django-templated-email >= 2.3, <4
html2text
Expand Down
3 changes: 0 additions & 3 deletions testapp/testapp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'database_locks',
'notifications',
'testapp',
]
Expand Down Expand Up @@ -122,8 +121,6 @@

STATIC_URL = '/static/'

DATABASE_LOCKS_ENABLED = False

try:
from .local_settings import *
except ImportError:
Expand Down

0 comments on commit 70d788f

Please sign in to comment.