From 31976ecfebf5cbad49e5a63acd94cf81aa69839d Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Mon, 6 Jul 2020 10:33:54 +1000 Subject: [PATCH] PERF: only update etag when it changes Previously when synchronizing upload etags we would update every single one regardless of change. --- lib/s3_inventory.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/s3_inventory.rb b/lib/s3_inventory.rb index 295e6cf7af8..06265ff8e96 100644 --- a/lib/s3_inventory.rb +++ b/lib/s3_inventory.rb @@ -58,8 +58,9 @@ class S3Inventory connection.async_exec("UPDATE #{model.table_name} SET etag = #{table_name}.etag FROM #{table_name} - WHERE #{model.table_name}.etag IS NULL - AND #{model.table_name}.url = #{table_name}.url") + WHERE #{model.table_name}.etag IS NULL AND + #{model.table_name}.etag <> #{table_name}.etag AND + #{model.table_name}.url = #{table_name}.url") list_missing_post_uploads if type == "original"