Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
57f6c496
Unverified
Commit
57f6c496
authored
2 years ago
by
Andrew Morgan
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
URL preview cache expiry logs: INFO -> DEBUG, text clarifications (#12720)
parent
17e1eb77
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/12720.misc
+1
-0
1 addition, 0 deletions
changelog.d/12720.misc
synapse/rest/media/v1/preview_url_resource.py
+21
-9
21 additions, 9 deletions
synapse/rest/media/v1/preview_url_resource.py
with
22 additions
and
9 deletions
changelog.d/12720.misc
0 → 100644
+
1
−
0
View file @
57f6c496
Drop the logging level of status messages for the URL preview cache expiry job from INFO to DEBUG.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
synapse/rest/media/v1/preview_url_resource.py
+
21
−
9
View file @
57f6c496
...
@@ -668,7 +668,7 @@ class PreviewUrlResource(DirectServeJsonResource):
...
@@ -668,7 +668,7 @@ class PreviewUrlResource(DirectServeJsonResource):
logger
.
debug
(
"
Running url preview cache expiry
"
)
logger
.
debug
(
"
Running url preview cache expiry
"
)
if
not
(
await
self
.
store
.
db_pool
.
updates
.
has_completed_background_updates
()):
if
not
(
await
self
.
store
.
db_pool
.
updates
.
has_completed_background_updates
()):
logger
.
info
(
"
Still running DB updates; skipping expiry
"
)
logger
.
debug
(
"
Still running DB updates; skipping
url preview cache
expiry
"
)
return
return
def
try_remove_parent_dirs
(
dirs
:
Iterable
[
str
])
->
None
:
def
try_remove_parent_dirs
(
dirs
:
Iterable
[
str
])
->
None
:
...
@@ -688,7 +688,9 @@ class PreviewUrlResource(DirectServeJsonResource):
...
@@ -688,7 +688,9 @@ class PreviewUrlResource(DirectServeJsonResource):
# Failed, skip deleting the rest of the parent dirs
# Failed, skip deleting the rest of the parent dirs
if
e
.
errno
!=
errno
.
ENOTEMPTY
:
if
e
.
errno
!=
errno
.
ENOTEMPTY
:
logger
.
warning
(
logger
.
warning
(
"
Failed to remove media directory: %r: %s
"
,
dir
,
e
"
Failed to remove media directory while clearing url preview cache: %r: %s
"
,
dir
,
e
,
)
)
break
break
...
@@ -703,7 +705,11 @@ class PreviewUrlResource(DirectServeJsonResource):
...
@@ -703,7 +705,11 @@ class PreviewUrlResource(DirectServeJsonResource):
except
FileNotFoundError
:
except
FileNotFoundError
:
pass
# If the path doesn't exist, meh
pass
# If the path doesn't exist, meh
except
OSError
as
e
:
except
OSError
as
e
:
logger
.
warning
(
"
Failed to remove media: %r: %s
"
,
media_id
,
e
)
logger
.
warning
(
"
Failed to remove media while clearing url preview cache: %r: %s
"
,
media_id
,
e
,
)
continue
continue
removed_media
.
append
(
media_id
)
removed_media
.
append
(
media_id
)
...
@@ -714,9 +720,11 @@ class PreviewUrlResource(DirectServeJsonResource):
...
@@ -714,9 +720,11 @@ class PreviewUrlResource(DirectServeJsonResource):
await
self
.
store
.
delete_url_cache
(
removed_media
)
await
self
.
store
.
delete_url_cache
(
removed_media
)
if
removed_media
:
if
removed_media
:
logger
.
info
(
"
Deleted %d entries from url cache
"
,
len
(
removed_media
))
logger
.
debug
(
"
Deleted %d entries from url preview cache
"
,
len
(
removed_media
)
)
else
:
else
:
logger
.
debug
(
"
No entries removed from url cache
"
)
logger
.
debug
(
"
No entries removed from url
preview
cache
"
)
# Now we delete old images associated with the url cache.
# Now we delete old images associated with the url cache.
# These may be cached for a bit on the client (i.e., they
# These may be cached for a bit on the client (i.e., they
...
@@ -733,7 +741,9 @@ class PreviewUrlResource(DirectServeJsonResource):
...
@@ -733,7 +741,9 @@ class PreviewUrlResource(DirectServeJsonResource):
except
FileNotFoundError
:
except
FileNotFoundError
:
pass
# If the path doesn't exist, meh
pass
# If the path doesn't exist, meh
except
OSError
as
e
:
except
OSError
as
e
:
logger
.
warning
(
"
Failed to remove media: %r: %s
"
,
media_id
,
e
)
logger
.
warning
(
"
Failed to remove media from url preview cache: %r: %s
"
,
media_id
,
e
)
continue
continue
dirs
=
self
.
filepaths
.
url_cache_filepath_dirs_to_delete
(
media_id
)
dirs
=
self
.
filepaths
.
url_cache_filepath_dirs_to_delete
(
media_id
)
...
@@ -745,7 +755,9 @@ class PreviewUrlResource(DirectServeJsonResource):
...
@@ -745,7 +755,9 @@ class PreviewUrlResource(DirectServeJsonResource):
except
FileNotFoundError
:
except
FileNotFoundError
:
pass
# If the path doesn't exist, meh
pass
# If the path doesn't exist, meh
except
OSError
as
e
:
except
OSError
as
e
:
logger
.
warning
(
"
Failed to remove media: %r: %s
"
,
media_id
,
e
)
logger
.
warning
(
"
Failed to remove media from url preview cache: %r: %s
"
,
media_id
,
e
)
continue
continue
removed_media
.
append
(
media_id
)
removed_media
.
append
(
media_id
)
...
@@ -758,9 +770,9 @@ class PreviewUrlResource(DirectServeJsonResource):
...
@@ -758,9 +770,9 @@ class PreviewUrlResource(DirectServeJsonResource):
await
self
.
store
.
delete_url_cache_media
(
removed_media
)
await
self
.
store
.
delete_url_cache_media
(
removed_media
)
if
removed_media
:
if
removed_media
:
logger
.
info
(
"
Deleted %d media from url cache
"
,
len
(
removed_media
))
logger
.
debug
(
"
Deleted %d media from url
preview
cache
"
,
len
(
removed_media
))
else
:
else
:
logger
.
debug
(
"
No media removed from url cache
"
)
logger
.
debug
(
"
No media removed from url
preview
cache
"
)
def
_is_media
(
content_type
:
str
)
->
bool
:
def
_is_media
(
content_type
:
str
)
->
bool
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment