mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-09 14:35:13 -04:00
Replace returnValue with return (#5736)
This commit is contained in:
parent
18a466b84e
commit
4806651744
177 changed files with 1359 additions and 1513 deletions
|
@ -182,7 +182,7 @@ class PreviewUrlResource(DirectServeResource):
|
|||
og = cache_result["og"]
|
||||
if isinstance(og, six.text_type):
|
||||
og = og.encode("utf8")
|
||||
defer.returnValue(og)
|
||||
return og
|
||||
return
|
||||
|
||||
media_info = yield self._download_url(url, user)
|
||||
|
@ -284,7 +284,7 @@ class PreviewUrlResource(DirectServeResource):
|
|||
media_info["created_ts"],
|
||||
)
|
||||
|
||||
defer.returnValue(jsonog)
|
||||
return jsonog
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def _download_url(self, url, user):
|
||||
|
@ -354,22 +354,20 @@ class PreviewUrlResource(DirectServeResource):
|
|||
# therefore not expire it.
|
||||
raise
|
||||
|
||||
defer.returnValue(
|
||||
{
|
||||
"media_type": media_type,
|
||||
"media_length": length,
|
||||
"download_name": download_name,
|
||||
"created_ts": time_now_ms,
|
||||
"filesystem_id": file_id,
|
||||
"filename": fname,
|
||||
"uri": uri,
|
||||
"response_code": code,
|
||||
# FIXME: we should calculate a proper expiration based on the
|
||||
# Cache-Control and Expire headers. But for now, assume 1 hour.
|
||||
"expires": 60 * 60 * 1000,
|
||||
"etag": headers["ETag"][0] if "ETag" in headers else None,
|
||||
}
|
||||
)
|
||||
return {
|
||||
"media_type": media_type,
|
||||
"media_length": length,
|
||||
"download_name": download_name,
|
||||
"created_ts": time_now_ms,
|
||||
"filesystem_id": file_id,
|
||||
"filename": fname,
|
||||
"uri": uri,
|
||||
"response_code": code,
|
||||
# FIXME: we should calculate a proper expiration based on the
|
||||
# Cache-Control and Expire headers. But for now, assume 1 hour.
|
||||
"expires": 60 * 60 * 1000,
|
||||
"etag": headers["ETag"][0] if "ETag" in headers else None,
|
||||
}
|
||||
|
||||
def _start_expire_url_cache_data(self):
|
||||
return run_as_background_process(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue