Skip to content

Commit

Permalink
Merge pull request #76 from nansencenter/issue75_lost_synchronisation
Browse files Browse the repository at this point in the history
Fix lost sychronisation errors
  • Loading branch information
aperrin66 authored Jan 29, 2021
2 parents 59fa97d + 0f65b19 commit 077f6ca
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions geospaas_harvesting/harvest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import time
from datetime import datetime
import django
import django.db
import yaml
# Load Django settings to be able to interact with the database
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'geospaas_harvesting.settings')
Expand Down Expand Up @@ -203,6 +204,9 @@ def load_or_create_harvester(harvester_name, harvester_config, load_dumped=True)

def launch_harvest(harvester_name, harvester_config, dump_on_interruption=True):
"""Launch the harvest operation and process errors. Meant to be run in a separate process"""
# Force the creation of a new database connection for each new process
django.db.connection.close()

try:
harvester = load_or_create_harvester(harvester_name, harvester_config, dump_on_interruption)
harvester.harvest()
Expand Down

0 comments on commit 077f6ca

Please sign in to comment.