Fix get_running_loop (python<3.7) (#6765)
This commit is contained in:
@@ -11,8 +11,14 @@ from pprint import pformat
|
|||||||
from random import choices
|
from random import choices
|
||||||
from statistics import mean, median, stdev
|
from statistics import mean, median, stdev
|
||||||
from typing import TYPE_CHECKING, Dict, NamedTuple, Tuple, List
|
from typing import TYPE_CHECKING, Dict, NamedTuple, Tuple, List
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
if sys.version_info[:2] >= (3, 7):
|
||||||
|
from asyncio import get_running_loop
|
||||||
|
else:
|
||||||
|
from asyncio import _get_running_loop as get_running_loop # noqa: F401
|
||||||
|
|
||||||
from .logging import Logger
|
from .logging import Logger
|
||||||
from .util import profiler
|
from .util import profiler
|
||||||
from .lnrouter import fee_for_edge_msat
|
from .lnrouter import fee_for_edge_msat
|
||||||
@@ -119,7 +125,7 @@ class LNRater(Logger):
|
|||||||
async def _analyze_graph(self):
|
async def _analyze_graph(self):
|
||||||
await self.channel_db.data_loaded.wait()
|
await self.channel_db.data_loaded.wait()
|
||||||
self._collect_policies_by_node()
|
self._collect_policies_by_node()
|
||||||
loop = asyncio.get_running_loop()
|
loop = get_running_loop()
|
||||||
# the analysis is run in an executor because it's costly
|
# the analysis is run in an executor because it's costly
|
||||||
await loop.run_in_executor(None, self._collect_purged_stats)
|
await loop.run_in_executor(None, self._collect_purged_stats)
|
||||||
self._rate_nodes()
|
self._rate_nodes()
|
||||||
|
|||||||
Reference in New Issue
Block a user