summaryrefslogtreecommitdiffstats
path: root/stator
diff options
context:
space:
mode:
authorAndrew Godwin2022-11-18 17:24:43 -0700
committerAndrew Godwin2022-11-18 17:24:43 -0700
commit80193114909a3f6ca1eda9a47b6330ef249a8ee5 (patch)
tree488baeeb9ab98a2d27500c03af70a0a25758e91a /stator
parent81de10b70c85c5222b17d8c4358a8aa8812f2559 (diff)
downloadtakahe-80193114909a3f6ca1eda9a47b6330ef249a8ee5.tar.gz
takahe-80193114909a3f6ca1eda9a47b6330ef249a8ee5.tar.bz2
takahe-80193114909a3f6ca1eda9a47b6330ef249a8ee5.zip
Deployment re-jiggling
Diffstat (limited to 'stator')
-rw-r--r--stator/runner.py6
-rw-r--r--stator/views.py12
2 files changed, 12 insertions, 6 deletions
diff --git a/stator/runner.py b/stator/runner.py
index 187aa47..bb1b009 100644
--- a/stator/runner.py
+++ b/stator/runner.py
@@ -19,9 +19,9 @@ class StatorRunner:
def __init__(
self,
models: List[Type[StatorModel]],
- concurrency: int = 30,
- concurrency_per_model: int = 5,
- run_period: int = 30,
+ concurrency: int = 50,
+ concurrency_per_model: int = 10,
+ run_period: int = 60,
wait_period: int = 30,
):
self.models = models
diff --git a/stator/views.py b/stator/views.py
index ef09b8e..9d2e154 100644
--- a/stator/views.py
+++ b/stator/views.py
@@ -1,8 +1,9 @@
-from django.http import HttpResponse
+from django.conf import settings
+from django.http import HttpResponse, HttpResponseForbidden
from django.views import View
+from stator.models import StatorModel
from stator.runner import StatorRunner
-from users.models import Follow
class RequestRunner(View):
@@ -12,6 +13,11 @@ class RequestRunner(View):
"""
async def get(self, request):
- runner = StatorRunner([Follow])
+ # Check the token, if supplied
+ if settings.STATOR_TOKEN:
+ if request.GET.get("token") != settings.STATOR_TOKEN:
+ return HttpResponseForbidden()
+ # Run on all models
+ runner = StatorRunner(StatorModel.subclasses)
handled = await runner.run()
return HttpResponse(f"Handled {handled}")