Skip to content

Commit

Permalink
Proper kill after processing.
Browse files Browse the repository at this point in the history
  • Loading branch information
basilfx committed Jul 25, 2017
1 parent eae2a41 commit 34d9a2e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions photod-backend/photod/cli/management/commands/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ def handle(self, *args, **options):
job.save()

# Wait for the processes to finish.
self.stdout.write(
self.style.SUCCESS('Waiting for workers to finish.'))
self.stdout.write(self.style.SUCCESS(
'Waiting for workers to finish.'))
pool.close_and_join()
except KeyboardInterrupt:
self.stdout.write(self.style.WARNING(
'Interrupt received, killing workers softly.'))
pool.close_and_join()
finally:
# Update job.
Expand Down

0 comments on commit 34d9a2e

Please sign in to comment.