Added conversation timeout in ConversationHandler#895
Added conversation timeout in ConversationHandler#895tsnoam merged 4 commits intopython-telegram-bot:masterfrom evgfilim1:conversation-timeout
Conversation
Codecov Report
@@ Coverage Diff @@
## master #895 +/- ##
==========================================
- Coverage 92.25% 91.82% -0.43%
==========================================
Files 103 103
Lines 4169 4060 -109
Branches 669 641 -28
==========================================
- Hits 3846 3728 -118
- Misses 188 193 +5
- Partials 135 139 +4
|
|
Looks good to me. |
telegram/ext/conversationhandler.py
Outdated
| new_state = self.current_handler.handle_update(update, dispatcher) | ||
|
|
||
| if self.timeout_job is not None: | ||
| self.timeout_job.schedule_removal() |
There was a problem hiding this comment.
Do I understand correctly that there is only a single timeout job which gets removed whenever any conversation is triggered?
Wouldn't you want to use a different job for each conversation?
There was a problem hiding this comment.
This timeout job is triggered in any conversation state, if you mean this. For different ConversationHandler instances the job is different too.
UPD. Yes, you're right, I have to use a different job.
telegram/ext/conversationhandler.py
Outdated
| per_user=True, | ||
| per_message=False): | ||
| per_message=False, | ||
| conversation_timeout=0): |
There was a problem hiding this comment.
I prefer None as the default value for no timeout
There was a problem hiding this comment.
I'll change it, but there is no difference, I think.
| update = Update(0, message=message) | ||
| assert not handler.check_update(update) | ||
|
|
||
| def test_conversation_timeout(self, dp, bot, user1): |
There was a problem hiding this comment.
Related to the comment above, perhaps adding a test for 2 users would be prudent.
|
@jh0ker Done UPD. This branch is based on an old revision of |
|
Hi, because you're latest commit has [ci skip] the latest version is not run on CI's and codecov. Could rebase on current master and commit so it will run a full CI? Thanks |
|
@Eldinnie I know, I marked it because there are no useful changes (I removed a line with comment that is not needed at all) |
|
Maybe we remove "pending reply" label? |
|
@evgfilim1 |
|
@tsnoam done. |
|
|
|
@evgfilim1 Thank you for your contribution |
Closes #648
Short usage: