You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The file_downloaded signal is sent too early during the file download request. This is bad for e.g. invenio-stats, which relies on the signal for gathering file download statistics. In case the download is interrupted for some reason (e.g. connection dropped or the user canceled the download), the signal will already have been sent.
A possible solution is to use the flask.after_this_request callback, and send the signal afterward if the request was successful (i.e. 2xx/3xx).
The text was updated successfully, but these errors were encountered:
slint
added a commit
to slint/invenio-files-rest
that referenced
this issue
Jun 7, 2018
True. In general, after some local testing, apparently, it's not easy (if even possible at all) to keep track of when a file was actually downloaded or if the connection was dropped... One idea is using werkzeug.wsgi.ClosingIterator which can execute a callback after the .close() is called for the file, but this still doesn't solve the issue...
(TBH the issue rises from what COUNTER and other discussions related to datasets/files would like to track about files. One of the things e.g. is the total transferred volume of a dataset/file, which one cannot know unless we know that the file arrived someplace...)
The
file_downloaded
signal is sent too early during the file download request. This is bad for e.g.invenio-stats
, which relies on the signal for gathering file download statistics. In case the download is interrupted for some reason (e.g. connection dropped or the user canceled the download), the signal will already have been sent.A possible solution is to use the
flask.after_this_request
callback, and send the signal afterward if the request was successful (i.e. 2xx/3xx).The text was updated successfully, but these errors were encountered: