mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-25 05:42:23 +00:00
Only accept GDrive notifications if the content was updated
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
parent
0f5d0c8b40
commit
b7344566ef
@ -1893,6 +1893,10 @@ class GSheetNotificationsView(View):
|
|||||||
if request.headers['X-Goog-Channel-ID'] != expected_channel_id:
|
if request.headers['X-Goog-Channel-ID'] != expected_channel_id:
|
||||||
raise ValueError(f"Invalid channel ID: {request.headers['X-Goog-Channel-ID']}")
|
raise ValueError(f"Invalid channel ID: {request.headers['X-Goog-Channel-ID']}")
|
||||||
|
|
||||||
|
if request.headers['X-Goog-Resource-State'] != 'update' \
|
||||||
|
or 'content' not in request.headers['X-Goog-Changed'].split(','):
|
||||||
|
return HttpResponse(status=204)
|
||||||
|
|
||||||
# Run the parsing in dedicated executors since it takes time
|
# Run the parsing in dedicated executors since it takes time
|
||||||
executor = ThreadPoolExecutor()
|
executor = ThreadPoolExecutor()
|
||||||
async for pool in tournament.pools.prefetch_related('participations', 'passages__notes', 'juries').all():
|
async for pool in tournament.pools.prefetch_related('participations', 'passages__notes', 'juries').all():
|
||||||
|
Loading…
Reference in New Issue
Block a user