Skip to content

Commit 0d21853

Browse files
committed
astrometry.net: only query for job id once, rather than each time through the job-status polling loop
1 parent e0731e7 commit 0d21853

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

astroquery/astrometry_net/core.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,12 @@ def monitor_submission(self, submission_id, *,
246246
status = ''
247247
while not has_completed:
248248
time.sleep(1)
249-
sub_stat_url = url_helpers.join(self.API_URL, 'submissions', str(submission_id))
250-
sub_stat = self._request('GET', sub_stat_url, cache=False)
251-
jobs = sub_stat.json()['jobs']
252-
if jobs:
253-
job_id = jobs[0]
249+
if job_id is None:
250+
sub_stat_url = url_helpers.join(self.API_URL, 'submissions', str(submission_id))
251+
sub_stat = self._request('GET', sub_stat_url, cache=False)
252+
jobs = sub_stat.json()['jobs']
253+
if jobs:
254+
job_id = jobs[0]
254255
if job_id:
255256
job_stat_url = url_helpers.join(self.API_URL, 'jobs',
256257
str(job_id), 'info')

0 commit comments

Comments
 (0)