forked from LBRYCommunity/lbry-sdk
commit
1574bca8a8
1 changed files with 6 additions and 8 deletions
|
@ -7,8 +7,6 @@ from binascii import hexlify
|
|||
from collections import defaultdict
|
||||
from dataclasses import dataclass
|
||||
from contextvars import ContextVar
|
||||
from concurrent.futures.thread import ThreadPoolExecutor
|
||||
from concurrent.futures.process import ProcessPoolExecutor
|
||||
from typing import Tuple, List, Union, Callable, Any, Awaitable, Iterable, Dict, Optional
|
||||
from datetime import date
|
||||
from prometheus_client import Gauge, Counter, Histogram
|
||||
|
@ -19,6 +17,12 @@ from .transaction import Transaction, Output, OutputScript, TXRefImmutable, Inpu
|
|||
from .constants import TXO_TYPES, CLAIM_TYPES
|
||||
from .util import date_to_julian_day
|
||||
|
||||
from concurrent.futures.thread import ThreadPoolExecutor # pylint: disable=wrong-import-order
|
||||
if platform.system() == 'Windows' or 'ANDROID_ARGUMENT' or 'KIVY_BUILD' in os.environ:
|
||||
from concurrent.futures.thread import ThreadPoolExecutor as ReaderExecutorClass # pylint: disable=reimported
|
||||
else:
|
||||
from concurrent.futures.process import ProcessPoolExecutor as ReaderExecutorClass
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
sqlite3.enable_callback_tracebacks(True)
|
||||
|
@ -62,12 +66,6 @@ def run_read_only_fetchone(sql, params):
|
|||
raise
|
||||
|
||||
|
||||
if platform.system() == 'Windows' or 'ANDROID_ARGUMENT' in os.environ:
|
||||
ReaderExecutorClass = ThreadPoolExecutor
|
||||
else:
|
||||
ReaderExecutorClass = ProcessPoolExecutor
|
||||
|
||||
|
||||
class AIOSQLite:
|
||||
reader_executor: ReaderExecutorClass
|
||||
|
||||
|
|
Loading…
Reference in a new issue