janko/tus-ruby-server

Setting to update expire timestamp on PATCH requests

KieranP opened this issue · 5 comments

We handle many GBs of video footage uploads per day. When an upload is finished, we move the file, upload to a CDN, then delete it. But if a person stops the upload half way and doesn't resume, we have say 20GB sitting there for 24 hours taking up disk space.

What we need is a setting to enable the upload expire timestamp to be updated with each PATCH request. The PATCH request keeps the file fresh, and if they stop uploading the file, it no longer gets updated. That we can set the expirator to run every 15 minutes without fear of it deleting files that are still being uploaded.

@janko-m Thoughts?

According to the spec, this sort of timestamp update is allowed by the server.

See this discussion: tus/tus-resumable-upload-protocol#100

janko commented

@KieranP Thanks for bringing it up! Yeah, that makes total sense. I don't see any reason why this shouldn't be the default behaviour. I'll go ahead and make the changes.

janko commented

@KieranP It would be greatly appreciated if you could test this out before I release a new version.

@janko-m Awesome, pushed this right into production, it's working great. Have been able to set an expiration_time of 1 hour and expiration interval of 15 minutes, and it's working great. Expiry date is being updated with each patch request, and when an upload has been abandoned for over an hour, it gets cleaned up quite nicely. Perfectly suits what we need :-)

janko commented

@kirenp That's great to hear! I've released version 0.2.0 with the new expiration refreshing.