@@ -288,13 +288,13 @@ func _bzz_do_request_text(
288288 on_failure.call(error)
289289 return
290290
291+ # Keep polling for as long as the request is being processed.
291292 while self._bzz_client.get_status() == HTTPClient.STATUS_REQUESTING:
292- # Keep polling for as long as the request is being processed.
293- self._bzz_client.poll()
294293 self._bzz_config.log_debug("Requesting…")
295294 if self._bzz_config.polling_interval_ms:
296295 OS.delay_msec(self._bzz_config.polling_interval_ms)
297296 await _bzz_next_loop_iteration()
297+ self._bzz_client.poll()
298298
299299 if not self._bzz_client.has_response():
300300 var error := {{> partials/api_error_class_name }} .new()
@@ -321,14 +321,14 @@ func _bzz_do_request_text(
321321 var response_bytes := PackedByteArray()
322322
323323 while self._bzz_client.get_status() == HTTPClient.STATUS_BODY:
324- self._bzz_client.poll()
325324 var chunk = self._bzz_client.read_response_body_chunk()
326325 if chunk.size() == 0: # Got nothing, wait for buffers to fill a bit.
327326 if self._bzz_config.polling_interval_ms:
328327 OS.delay_usec(self._bzz_config.polling_interval_ms)
329328 await _bzz_next_loop_iteration()
330329 else: # Yummy data has arrived
331330 response_bytes = response_bytes + chunk
331+ self._bzz_client.poll()
332332
333333 self._bzz_config.log_info("%s: RESPONSE %d (%d bytes)" % [
334334 _bzz_name, response.code, response_bytes.size()
0 commit comments