Skip to content

Commit 739bfaa

Browse files
authored
Fix closed loop in tg interface (#424)
Fix bug with improperly closed loop when using TG interface.
1 parent d1732b2 commit 739bfaa

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

chatsky/messengers/telegram/interface.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ def __init__(
4242
async def connect(self, pipeline_runner: PipelineRunnerFunction, *args, **kwargs):
4343
await super().connect(pipeline_runner, *args, **kwargs)
4444
self.application.run_polling(
45-
poll_interval=self.interval, timeout=self.timeout, allowed_updates=Update.ALL_TYPES
45+
poll_interval=self.interval,
46+
timeout=self.timeout,
47+
allowed_updates=Update.ALL_TYPES,
48+
close_loop=False,
4649
)
4750

4851

@@ -70,4 +73,9 @@ def __init__(
7073

7174
async def connect(self, pipeline_runner: PipelineRunnerFunction, *args, **kwargs):
7275
await super().connect(pipeline_runner, *args, **kwargs)
73-
self.application.run_webhook(listen=self.listen, port=self.port, allowed_updates=Update.ALL_TYPES)
76+
self.application.run_webhook(
77+
listen=self.listen,
78+
port=self.port,
79+
allowed_updates=Update.ALL_TYPES,
80+
close_loop=False,
81+
)

tests/messengers/telegram/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ def _run_bot(self) -> None:
121121
else:
122122
raise RuntimeError(f"Update {update} type unknown!")
123123

124-
def run_polling(self, poll_interval: float, timeout: int, allowed_updates: List[str]) -> None:
124+
def run_polling(self, *_, **__) -> None:
125125
return self._run_bot()
126126

127-
def run_webhook(self, listen: str, port: str, allowed_updates: List[str]) -> None:
127+
def run_webhook(self, *_, **__) -> None:
128128
return self._run_bot()

0 commit comments

Comments
 (0)