• EnglishEspañol日本語한국어Português
  • ログイン今すぐ開始

この機械翻訳は、参考として提供されています。

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.

問題を作成する

ensure_futureを使用する際の情報の欠落(Python)

問題

コルーチンでasyncio.ensure_futureを使用する場合、詳細な関数トレース情報は表示されません。

解決

ensure_futureから作成された Future は、作成されたのと同じコルーチン内で待機する必要があります。たとえば、 Beforeセクションでは、 awaitensure_futureとともに存在しないため、情報が欠落します。

Before:

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

:

import asyncio
async def foo():
await ensure_future(bar())
async def bar():
await asyncio.sleep(0.5)
Copyright © 2024 New Relic株式会社。

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