Merge branch 'develop' into freqtrade-development
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Any, Dict, Iterator, Optional
|
||||
|
||||
from freqtrade.persistence import Trade
|
||||
from freqtrade.rpc.rpc import RPC, RPCException
|
||||
|
||||
from .webserver import ApiServer
|
||||
@@ -11,10 +12,12 @@ def get_rpc_optional() -> Optional[RPC]:
|
||||
return None
|
||||
|
||||
|
||||
def get_rpc() -> Optional[RPC]:
|
||||
def get_rpc() -> Optional[Iterator[RPC]]:
|
||||
_rpc = get_rpc_optional()
|
||||
if _rpc:
|
||||
return _rpc
|
||||
Trade.query.session.rollback()
|
||||
yield _rpc
|
||||
Trade.query.session.rollback()
|
||||
else:
|
||||
raise RPCException('Bot is not in the correct state')
|
||||
|
||||
|
@@ -25,6 +25,7 @@ from freqtrade.constants import DUST_PER_COIN
|
||||
from freqtrade.enums import RPCMessageType
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.misc import chunks, plural, round_coin_value
|
||||
from freqtrade.persistence import Trade
|
||||
from freqtrade.rpc import RPC, RPCException, RPCHandler
|
||||
|
||||
|
||||
@@ -59,7 +60,8 @@ def authorized_only(command_handler: Callable[..., None]) -> Callable[..., Any]:
|
||||
update.message.chat_id
|
||||
)
|
||||
return wrapper
|
||||
|
||||
# Rollback session to avoid getting data stored in a transaction.
|
||||
Trade.query.session.rollback()
|
||||
logger.debug(
|
||||
'Executing handler: %s for chat_id: %s',
|
||||
command_handler.__name__,
|
||||
|
Reference in New Issue
Block a user