This commit is contained in:
Your Name 2021-09-15 14:21:29 -04:00
parent 3ed68732f3
commit 2b3dc53d96
3 changed files with 5 additions and 4 deletions

View file

@ -91,7 +91,7 @@ class OAuth2Backend(ModelBackend):
# when username is provided, assume that token is newly obtained and valid
try:
user = UserModel._default_manager.filter(username=username, mastodon_site=site)
user = UserModel._default_manager.get(username=username, mastodon_site=site)
except UserModel.DoesNotExist:
return None
else:

View file

@ -7,5 +7,4 @@ class SyncConfig(AppConfig):
def ready(self):
from sync.jobs import sync_task_manager
if settings.START_SYNC:
sync_task_manager.start()
sync_task_manager.start()

View file

@ -7,6 +7,7 @@ import threading
import time
from dataclasses import dataclass
from datetime import datetime
from django.conf import settings
from django.utils import timezone
from django.core.exceptions import ObjectDoesNotExist
from openpyxl import load_workbook
@ -73,7 +74,8 @@ class SyncTaskManger:
return self.__stop_event.is_set()
def start(self):
self.__enqueue_existing_tasks() # enqueue
if settings.START_SYNC:
self.__enqueue_existing_tasks() # enqueue
listen_new_task_thread = threading.Thread(
target=self.__listen_for_new_task, daemon=True)