Skip to content

Commit

Permalink
Bug 1265037 - Fix edge case in migration script
Browse files Browse the repository at this point in the history
If ingestion was ongoing during the migration, it was possible for things
to error out since operations were batched inside a transaction. Since
it should be rare to need to insert new items when this script is being
run, just skip the transaction.
  • Loading branch information
wlach committed Apr 26, 2016
1 parent ae12275 commit a36773f
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,10 @@ def handle(self, *args, **options):
if len(existing_jobs) < len(datasource_jobs):
# only even bother trying to create new jobs if they
# haven't been created already
with transaction.atomic():
for datasource_job in datasource_jobs:
Job.objects.get_or_create(
repository=repository,
guid=datasource_job['job_guid'],
project_specific_id=datasource_job['id'])
for datasource_job in datasource_jobs:
Job.objects.get_or_create(
repository=repository,
guid=datasource_job['job_guid'],
project_specific_id=datasource_job['id'])
offset += limit
time.sleep(options['interval'])

0 comments on commit a36773f

Please sign in to comment.