Generate fewer add_status_tasks
Previously, every time a status was saved, a task would start to add it to people's timelines. This meant there were a ton of duplicate tasks that were potentially heavy to run. Now, the Status model has a "ready" field which indicates that it's worth updating the timelines. It defaults to True, which prevents statuses from accidentally not being added due to ready state. The ready state is explicitly set to false in the view, which is the source of most of the noise for that task.
This commit is contained in:
parent
f0b73c18c1
commit
317cf5fcf5
7 changed files with 148 additions and 8 deletions
|
@ -82,13 +82,16 @@ class CreateStatus(View):
|
|||
return HttpResponseBadRequest()
|
||||
return redirect("/")
|
||||
|
||||
status = form.save(request)
|
||||
status = form.save(request, commit=False)
|
||||
status.ready = False
|
||||
# save the plain, unformatted version of the status for future editing
|
||||
status.raw_content = status.content
|
||||
if hasattr(status, "quote"):
|
||||
status.raw_quote = status.quote
|
||||
|
||||
status.sensitive = status.content_warning not in [None, ""]
|
||||
# the status has to be saved now before we can add many to many fields
|
||||
# like mentions
|
||||
status.save(broadcast=False)
|
||||
|
||||
# inspect the text for user tags
|
||||
|
@ -119,6 +122,7 @@ class CreateStatus(View):
|
|||
if hasattr(status, "quote"):
|
||||
status.quote = to_markdown(status.quote)
|
||||
|
||||
status.ready = True
|
||||
status.save(created=created)
|
||||
|
||||
# update a readthrough, if needed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue