diff --git a/readthedocs/oauth/__init__.py b/readthedocs/oauth/__init__.py index e69de29bb2d..510c93a3526 100644 --- a/readthedocs/oauth/__init__.py +++ b/readthedocs/oauth/__init__.py @@ -0,0 +1 @@ +default_app_config = 'readthedocs.oauth.apps.OAuthConfig' diff --git a/readthedocs/oauth/apps.py b/readthedocs/oauth/apps.py new file mode 100644 index 00000000000..57de2c82098 --- /dev/null +++ b/readthedocs/oauth/apps.py @@ -0,0 +1,12 @@ +"""OAuth app config""" + +from django.apps import AppConfig + + +class OAuthConfig(AppConfig): + name = 'readthedocs.oauth' + + def ready(self): + from .tasks import SyncRemoteRepositories + from readthedocs.worker import app + app.tasks.register(SyncRemoteRepositories) diff --git a/readthedocs/oauth/tasks.py b/readthedocs/oauth/tasks.py index 7f95f9610ea..4d0ad6336d4 100644 --- a/readthedocs/oauth/tasks.py +++ b/readthedocs/oauth/tasks.py @@ -11,6 +11,8 @@ @permission_check(user_id_matches) class SyncRemoteRepositories(PublicTask): + + name = __name__ + '.sync_remote_repositories' public_name = 'sync_remote_repositories' queue = 'web' diff --git a/readthedocs/restapi/views/task_views.py b/readthedocs/restapi/views/task_views.py index 148f0bba49d..6269b98f52c 100644 --- a/readthedocs/restapi/views/task_views.py +++ b/readthedocs/restapi/views/task_views.py @@ -53,7 +53,7 @@ def job_status(request, task_id): @decorators.permission_classes((permissions.IsAuthenticated,)) @decorators.renderer_classes((JSONRenderer,)) def sync_remote_repositories(request): - result = tasks.sync_remote_repositories.delay( + result = tasks.SyncRemoteRepositories().delay( user_id=request.user.id) task_id = result.task_id return Response({