• EnglishEspañol日本語한국어Português
  • Inicia sesiónComenzar ahora

Te ofrecemos esta traducción automática para facilitar la lectura.

In the event of any inconsistency between the English version and the translated version, the English versionwill take priority. Please visit this page for more information.

Crea una propuesta

Información faltante al usar ensure_future (Python)

Problema

La información detallada de la traza de la función no aparece cuando se usa asyncio.ensure_future en corrutinas.

Solución

Los futuros creados a partir de ensure_future deben esperarse en la misma rutina en la que se crearon. Por ejemplo, en la sección Before , await no está presente con ensure_future, lo que provocaría que falte información:

Before:

import asyncio
async def foo():
ensure_future(bar())
async def bar():
await asyncio.sleep(0.5)

After:

import asyncio
async def foo():
await ensure_future(bar())
async def bar():
await asyncio.sleep(0.5)
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.