Skip to content

Commit

Permalink
[nsidc_tests] Handle race condition if status completes early
Browse files Browse the repository at this point in the history
Got `UnboundLocalError: local variable 'loop_root' referenced before assignment` in CI because the order request status completed early, so need to declare the 'loop_root' variable early.
  • Loading branch information
weiji14 committed Aug 22, 2024
1 parent 9090378 commit 58a4a68
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions icepyx/core/granules.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@ def place_order(
status = statuslist[0]
print("Initial status of your order request at NSIDC is: ", status)

# If status is already finished without going into pending/processing
if status.startswith("complete"):
loop_response = self.session.get(statusURL)
loop_root = ET.fromstring(loop_response.content)

Check warning on line 405 in icepyx/core/granules.py

View check run for this annotation

Codecov / codecov/patch

icepyx/core/granules.py#L404-L405

Added lines #L404 - L405 were not covered by tests

# Continue loop while request is still processing
while status == "pending" or status == "processing":
print(
Expand Down

0 comments on commit 58a4a68

Please sign in to comment.