Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
funkwhale
funkwhale
Commits
5d3853d3
Unverified
Commit
5d3853d3
authored
May 17, 2022
by
petitminion
Committed by
Georg Krause
May 17, 2022
Browse files
Update api/funkwhale_api/federation/actors.py, api/funkwhale_api/federation/tasks.py
parent
8148c8dd
Pipeline
#20734
failed with stage
in 8 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
api/funkwhale_api/federation/actors.py
View file @
5d3853d3
import
datetime
import
logging
from
requests
import
HTTPError
from
django.conf
import
settings
from
django.utils
import
timezone
...
...
@@ -22,8 +21,6 @@ def get_actor_data(actor_url):
response
.
raise_for_status
()
try
:
return
response
.
json
()
except
HTTPError
:
raise
HTTPError
except
Exception
:
raise
ValueError
(
"Invalid actor payload: {}"
.
format
(
response
.
text
))
...
...
api/funkwhale_api/federation/tasks.py
View file @
5d3853d3
...
...
@@ -18,7 +18,6 @@ from funkwhale_api.common import preferences
from
funkwhale_api.common
import
models
as
common_models
from
funkwhale_api.common
import
session
from
funkwhale_api.common
import
utils
as
common_utils
from
funkwhale_api.federation
import
models
as
federation_models
from
funkwhale_api.federation
import
actors
as
actors_utils
from
funkwhale_api.moderation
import
mrf
from
funkwhale_api.music
import
models
as
music_models
...
...
@@ -372,7 +371,6 @@ def fetch(fetch_obj):
fetch_obj
.
url
=
alternate_url
fetch_obj
.
save
(
update_fields
=
[
"url"
])
return
fetch
(
fetch_id
=
fetch_obj
.
pk
)
logger
.
info
(
"json is"
+
str
(
response
.
text
))
return
error
(
"invalid_json"
)
payload
,
updated
=
mrf
.
inbox
.
apply
(
payload
)
...
...
@@ -633,7 +631,7 @@ def fetch_collection(url, max_pages, channel, is_page=False):
@
celery
.
app
.
task
(
name
=
"federation.refresh_actor_data"
)
def
refresh_actor_data
():
actors
=
federation_
models
.
Actor
.
objects
.
all
().
prefetch_related
()
actors
=
models
.
Actor
.
objects
.
all
().
prefetch_related
()
for
actor
in
actors
:
try
:
data
=
actors_utils
.
get_actor_data
(
actor
.
fid
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment