Skip to content

Commit 1ac230e

Browse files
authored
Merge pull request #3079 from dstndstn/issue-3078
Astrometry.net: reduce number of calls when polling for job status
2 parents e0731e7 + 1f99ac4 commit 1ac230e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ astrometry_net
1313

1414
- Remove photutils from Astroquery astrometry.net [#3067]
1515

16+
- Reduce the number of API calls when polling for job status [#3079]
17+
1618
alma
1719
^^^^
1820

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)