Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #212 from glogiotatidis/multiple-jobids-sentry
Browse files Browse the repository at this point in the history
Report and skip duplicate job IDs.
  • Loading branch information
glogiotatidis authored Jan 10, 2018
2 parents 7029e85 + 0d110c3 commit d5f6559
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions careers/careers/management/commands/sync_greenhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import bleach
import requests
from raven.contrib.django.models import client

from careers.careers.models import Position

Expand All @@ -29,6 +30,14 @@ def handle(self, *args, **options):

data = response.json()
for job in data['jobs']:
# Maybe GH sometimes includes jobs with the same ID multiple times
# in the json. Capture the event in Sentry and look the other way.
if job['id'] in job_ids:
client.captureMessage(
message='[GH Sync] Job {} twice in the same json'.format(job['id']),
data={'extra': {'jobs': data['jobs']}})
continue

job_ids.append(job['id'])

job_object, created = (Position.objects
Expand Down

0 comments on commit d5f6559

Please sign in to comment.