-
-
Notifications
You must be signed in to change notification settings - Fork 962
Allow running getUpdates without database connection #767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
noplanman
merged 15 commits into
php-telegram-bot:develop
from
jacklul:getupdates_without_db
Mar 18, 2018
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
218359f
Allow running getUpdates without database connection
jacklul 6048653
Merge branch 'develop' into getupdates_without_db
noplanman 538f658
Optimizations
jacklul 80a6790
Changelog entry for #767
jacklul 7a34308
Require an optional parameter to work without a database
jacklul fe721e0
Require user to manually enable non-DB mode using seperated method
jacklul c25baa9
Improve handling getUpdates without database
jacklul ef49524
Add getLastUpdateId() method returning last update id that was processed
jacklul 13d3205
Further optimizations
jacklul 496bb6c
Update changelog
jacklul 617b94f
Merge branch 'develop' into getupdates_without_db
jacklul 549eb25
Add an entry to the readme about using getUpdates without a database.
noplanman 0af2665
Merge remote-tracking branch 'origin/develop' into getupdates_without…
noplanman bee3a3e
Merge pull request #12 from noplanman/getupdates_without_db_docs
jacklul f765036
Merge branch 'develop' into getupdates_without_db
noplanman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for exactly? Why not just use the member variable directly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, no idea why I put it there
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait! Probably to let user access last update id inside hook script, the purpose of that would be setting a signal handler (to prevent not marking updates as handled)
Couldn't find other way to access it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't fully understand what you meant there. Where would this
signal_handler
method be called?Also, the
$signo
parameter isn't being used, what is that?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, lets say the bot is heavily used and has to handle 40 updates at once, when bot crashes in the middle of processing they aren't marked as handled, next time script is run they are re-processed.
About
$signo
, for some reason that function refused to work without that parameter there... I tested it on linux subsystem since pcntl doesn't work on Windows.Also that function is just an example, it can also be used to be called in
catch
block can also work after exceptions.The point of that method is to returnid of the update that was processed (I should probably move the assignement in
processUpdate
somewhere after, will do later)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aaah, right! You're using the pcntl signal handling, thought it was just a custom function you call somewhere.
Ok. I'm just wondering if there is a cleaner way to do this. Also, we'll have to document this somehow with the extra code required to register the signal handler.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a wiki article mentioning and example code will suffice.