Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change list of match ids to set for json_handler.py #395

Merged
merged 4 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## v0.66

- [#395](https://github.com/awslabs/amazon-s3-find-and-forget/issues/395):
Increase the speed of the json_handler by migrating from a list to a set.
Move from O(n) to O(1)

## v0.65

- [#393](https://github.com/awslabs/amazon-s3-find-and-forget/issues/393): Fix
Expand Down
4 changes: 2 additions & 2 deletions backend/ecs_tasks/delete_files/json_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def delete_matches_from_json_file(input_file, to_delete, compressed=False):
for column in to_delete:
if column["Type"] == "Simple":
record = get_value(column["Column"], parsed)
if record and record in column["MatchIds"]:
if record and record in set(column["MatchIds"]):
should_delete = True
break
else:
Expand All @@ -61,7 +61,7 @@ def delete_matches_from_json_file(input_file, to_delete, compressed=False):
record = get_value(col, parsed)
if record:
matched.append(record)
if matched in column["MatchIds"]:
if tuple(matched) in set(map(tuple, column["MatchIds"])):
should_delete = True
break
if should_delete:
Expand Down
4 changes: 2 additions & 2 deletions templates/template.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: Amazon S3 Find and Forget (uksb-1q2j8beb0) (version:v0.65) (tag:main)
Description: Amazon S3 Find and Forget (uksb-1q2j8beb0) (version:v0.66) (tag:main)

Parameters:
AccessControlAllowOriginOverride:
Expand Down Expand Up @@ -206,7 +206,7 @@ Conditions:
Mappings:
Solution:
Constants:
Version: 'v0.65'
Version: 'v0.66'

Resources:
TempBucket:
Expand Down
Loading