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

Constrain VirusScanWorker to one concurrent worker per asset #1263

Merged
merged 5 commits into from
Dec 11, 2023

Conversation

brucebolt
Copy link
Member

@brucebolt brucebolt commented Dec 7, 2023

This will prevent multiple jobs becoming enqueued for a single asset until the original job has finished executing.

We are currently seeing an issue where a user can replace the file after uploading but before the virus scan has completed. This results in a second virus scan being enqueued, which subsequently fails as the asset has been deleted from the filesystem. This should prevent that from happening.

Trello card

This will later be used to ensure we cannot enqueue the same asset twice
for virus checking.
@brucebolt brucebolt force-pushed the limit-virus-scan-workers branch 2 times, most recently from 4763424 to f4ee455 Compare December 7, 2023 14:17
Prior to version 7 of `sidekiq-unique-jobs`, the middleware was configured
automatically. It now has to be added to an initialiser.
This will allow us to test whether sidekiq jobs have been correctly
queued.
This will prevent multiple jobs becoming enqueued for a single asset
until the original job has finished executing.

We are currently seeing an issue where a user can replace the file after
uploading but before the virus scan has completed. This results in a
second virus scan being enqueued, which subsequently fails as the asset
has been deleted from the filesystem. This will prevent that from
happening.
@brucebolt brucebolt force-pushed the limit-virus-scan-workers branch from 904d90d to d0451ad Compare December 7, 2023 14:22
…e asset is unscanned"

This code won't be needed anymore, since we no longer permit two
concurrent workers to be enqueued for the same asset.

This reverts commit 4705054.
@brucebolt brucebolt changed the title Constrain VirusScanWorker to one worker per asset Constrain VirusScanWorker to one concurrent worker per asset Dec 7, 2023
@brucebolt brucebolt marked this pull request as ready for review December 7, 2023 14:47
Copy link
Contributor

@aldavidson aldavidson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - nice solution!

@brucebolt brucebolt merged commit 2c0f40e into main Dec 11, 2023
9 checks passed
@brucebolt brucebolt deleted the limit-virus-scan-workers branch December 11, 2023 08:07
jkempster34 added a commit that referenced this pull request Mar 18, 2024
Currently, when an asset is updated with a file which has the same name as the
previous file, the metadata (specifically the MD5 hexdigest) doesn't get
updated. There is a guard statement in the S3 uploader that prevents assets
with and unchanged MD5 hexdigest) from uploading.

This is due to a condition added in #1258 that was intended to quieten some
errors we were seeing at the time. This same issue was addressed in #1263.
jkempster34 added a commit that referenced this pull request Mar 18, 2024
Asset metadata is not being updated when an asset is uploaded with a file which
has the same name as the previous file. This is because of a condition added in
#1258 that was intended to quieten some errors we were seeing at the time. This
same issue was addressed in #1263.

This is problematic as there is a guard statement in the S3 uploader that
prevents assets with an unchanged MD5 hexdigest from uploading.
jkempster34 added a commit that referenced this pull request Mar 18, 2024
Asset metadata is not being updated when an asset is uploaded with a file which
has the same name as the previous file. This is because of a condition added in
#1258 that was intended to quieten some errors we were seeing at the time. This
same issue was addressed in #1263.

This is problematic as there is a guard statement in the S3 uploader that
prevents assets with an unchanged MD5 hexdigest from uploading.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants