Skip to content

Commit

Permalink
feat: added crontab to delete expired oauth tokens from db.
Browse files Browse the repository at this point in the history
Updated 0auth.. pls work for doodle...
  • Loading branch information
JasonLovesDoggo committed Jan 2, 2024
1 parent 33ad1f3 commit fb29987
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions core/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
PushMessage,
PushTicketError,
)
from oauth2_provider.models import clear_expired
from requests.exceptions import ConnectionError, HTTPError

from core.models import Announcement, User, Event, BlogPost
Expand Down Expand Up @@ -48,6 +49,7 @@ def users_with_token():
def setup_periodic_tasks(sender, **kwargs):
sender.add_periodic_task(crontab(hour=18, minute=0), notif_events_singleday)
sender.add_periodic_task(crontab(day_of_month=1), run_group_migrations)
sender.add_periodic_task(crontab(hour=1, minute=0), clear_expired) # Delete expired oauth2 tokens from db everyday at 1am


@app.task
Expand Down
4 changes: 2 additions & 2 deletions metropolis/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path
from oauth2_provider.urls import base_urlpatterns, app_name
from oauth2_provider.views import AuthorizationView, RevokeTokenView, TokenView

oauth2_endpoint_views = [
Expand All @@ -27,8 +28,7 @@

urlpatterns = [
path("", include("core.urls")),
path("", include("oauth2_provider.urls", namespace="oauth2_provider")),
path("o/", include("oauth2_provider.urls", namespace="oauth2_provider2")),
path("", include((base_urlpatterns, app_name), namespace=app_name)),
path("admin/", admin.site.urls),
path("accounts/", include("allauth.urls")),
path("martor/", include("martor.urls")),
Expand Down

0 comments on commit fb29987

Please sign in to comment.