Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TelegramBot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
TelegramBot
Commits
d7bf693d
Commit
d7bf693d
authored
Feb 06, 2017
by
Jack'lul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'Retry' is pointless, remove it
parent
fc49483a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
13 deletions
+5
-13
Request.php
src/Request.php
+5
-13
No files found.
src/Request.php
View file @
d7bf693d
...
...
@@ -1031,28 +1031,20 @@ class Request
if
((
isset
(
$data
[
'chat_id'
])
||
isset
(
$data
[
'inline_message_id'
]))
&&
in_array
(
$action
,
$limited_methods
))
{
$timeout
=
60
;
$retry
=
false
;
while
(
true
)
{
if
(
$timeout
<=
0
)
{
throw
new
TelegramException
(
'Timed out while waiting for a request slot!'
);
}
$requests
=
DB
::
getTelegramRequestCount
((
isset
(
$data
[
'chat_id'
])
?
$data
[
'chat_id'
]
:
null
),
(
isset
(
$data
[
'inline_message_id'
])
?
$data
[
'inline_message_id'
]
:
null
));
if
(
$requests
[
'LIMIT_PER_SEC'
]
<=
0
&&
((
isset
(
$data
[
'inline_message_id'
])
&&
$requests
[
'LIMIT_PER_SEC_ALL'
]
<
30
)
||
(
isset
(
$data
[
'chat_id'
])
&&
$data
[
'chat_id'
]
>
0
&&
$requests
[
'LIMIT_PER_SEC_ALL'
]
<
30
)
||
(
isset
(
$data
[
'chat_id'
])
&&
$data
[
'chat_id'
]
<
0
&&
$requests
[
'LIMIT_PER_MINUTE'
]
<
20
)))
{
break
;
}
sleep
(
1
);
$timeout
=
$timeout
-
1
;
if
(
$timeout
<=
0
)
{
if
(
$retry
)
{
throw
new
TelegramException
(
'Timed out while waiting for a request slot after 2 tries!'
);
}
else
{
$timeout
=
60
;
$retry
=
true
;
TelegramLog
::
debug
(
'Timed out while waiting for a request slot, retrying! Request data:'
.
PHP_EOL
.
print_r
(
$data
,
true
)
.
PHP_EOL
.
PHP_EOL
);
}
}
sleep
(
1
);
}
DB
::
insertTelegramRequest
(
$action
,
$data
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment