mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-29 02:31:00 +00:00
Only fanout remote posts younger than 1 day
This commit is contained in:
parent
6c72f25fbe
commit
18ab453baa
1 changed files with 5 additions and 1 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import datetime
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import mimetypes
|
import mimetypes
|
||||||
|
@ -75,6 +76,9 @@ class PostStates(StateGraph):
|
||||||
Creates all needed fan-out objects for a new Post.
|
Creates all needed fan-out objects for a new Post.
|
||||||
"""
|
"""
|
||||||
post = await instance.afetch_full()
|
post = await instance.afetch_full()
|
||||||
|
# Only fan out if the post was published in the last day or it's local
|
||||||
|
# (we don't want to fan out anything older that that which is remote)
|
||||||
|
if post.local or (timezone.now() - post.published) < datetime.timedelta(days=1):
|
||||||
await cls.targets_fan_out(post, FanOut.Types.post)
|
await cls.targets_fan_out(post, FanOut.Types.post)
|
||||||
await post.ensure_hashtags()
|
await post.ensure_hashtags()
|
||||||
return cls.fanned_out
|
return cls.fanned_out
|
||||||
|
|
Loading…
Reference in a new issue