Page Menu
Home
Search
Configure Global Search
Log In
Files
F13253451
file_link_tasks.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
850 B
Subscribers
None
file_link_tasks.py
View Options
from
pillar
import
current_app
@current_app.celery.task
(
ignore_result
=
True
)
def
regenerate_all_expired_links
(
backend_name
:
str
,
chunk_size
:
int
):
"""Regenerate all expired links for all non-deleted file documents.
Probably only works on Google Cloud Storage ('gcs') backends at
the moment, since those are the only links that actually expire.
:param backend_name: name of the backend to refresh for.
:param chunk_size: the maximum number of files to refresh in this run.
"""
from
pillar.api
import
file_storage
# Refresh all files that already have expired or will expire in the next
# two hours. Since this task is intended to run every hour, this should
# result in all regular file requests having a valid link.
file_storage
.
refresh_links_for_backend
(
backend_name
,
chunk_size
,
expiry_seconds
=
7200
)
File Metadata
Details
Attached
Mime Type
text/x-python
Expires
Tue, Jul 5, 11:36 AM (2 d)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
f4/0e/47950257b2995e2e2c85e8cd5a3c
Attached To
rPS Pillar
Event Timeline
Log In to Comment