From 23946b1e3a40ba59aa409414d5732415ba2ff42b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 27 May 2016 16:32:52 +0200 Subject: [PATCH] After Zencoder has finished, force update of the links on next file request. --- pillar/application/modules/encoding.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pillar/application/modules/encoding.py b/pillar/application/modules/encoding.py index 7e411cc1..7d5b9115 100644 --- a/pillar/application/modules/encoding.py +++ b/pillar/application/modules/encoding.py @@ -1,7 +1,9 @@ import logging + +import datetime import os -from bson import ObjectId +from bson import ObjectId, tz_util from eve.methods.put import put_internal from flask import Blueprint from flask import abort @@ -165,6 +167,10 @@ def zencoder_notifications(): }) file_doc['status'] = 'complete' + + # Force an update of the links on the next load of the file. + file_doc['link_expires'] = datetime.datetime.now(tz=tz_util.utc) - datetime.timedelta(days=1) + put_internal('files', file_doc, _id=file_id) return '', 204