Skip to content

Commit

Permalink
Merge pull request #540 from dandi/fix-optimize-tasks
Browse files Browse the repository at this point in the history
Fix optimize tasks
  • Loading branch information
dchiquito authored Oct 1, 2021
2 parents aa269d6 + 8e7d23e commit d93a1df
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions dandiapi/api/scheduled_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
@shared_task
@atomic
def validate_draft_version_metadata():
logger.info('Checking for draft versions that need validation')
# Select only the id of draft versions that have status PENDING
pending_draft_versions = (
Version.objects.filter(status=Version.Status.PENDING).filter(version='draft').values('id')
)
logger.info('Found %s versions to validate', pending_draft_versions.count())
for draft_version in pending_draft_versions:
validate_version_metadata.delay(draft_version['id'])

# Revalidation should be triggered every time a version is modified,
# so now is a good time to write out the manifests as well.
write_manifest_files.delay(draft_version.id)
if pending_draft_versions.count() > 0:
logger.info('Found %s versions to validate', pending_draft_versions.count())
for draft_version in pending_draft_versions:
validate_version_metadata.delay(draft_version['id'])

# Revalidation should be triggered every time a version is modified,
# so now is a good time to write out the manifests as well.
write_manifest_files.delay(draft_version['id'])


def register_scheduled_tasks(sender, **kwargs):
Expand Down

0 comments on commit d93a1df

Please sign in to comment.