Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
automatic_updates-3248909
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
automatic_updates-3248909
Commits
62c2f724
Commit
62c2f724
authored
5 years ago
by
Lucas Hedding
Committed by
Lucas Hedding
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3095416
by heddn: HTTP error 429 not handled appropriately
parent
81823dc6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
automatic_updates.module
+2
-2
2 additions, 2 deletions
automatic_updates.module
src/Services/InPlaceUpdate.php
+5
-2
5 additions, 2 deletions
src/Services/InPlaceUpdate.php
src/Services/Notify.php
+2
-2
2 additions, 2 deletions
src/Services/Notify.php
with
9 additions
and
6 deletions
automatic_updates.module
+
2
−
2
View file @
62c2f724
...
@@ -74,7 +74,7 @@ function automatic_updates_page_top(array &$page_top) {
...
@@ -74,7 +74,7 @@ function automatic_updates_page_top(array &$page_top) {
function
automatic_updates_cron
()
{
function
automatic_updates_cron
()
{
$state
=
\Drupal
::
state
();
$state
=
\Drupal
::
state
();
$request_time
=
\Drupal
::
time
()
->
getRequestTime
();
$request_time
=
\Drupal
::
time
()
->
getRequestTime
();
$last_check
=
$state
->
get
(
'automatic_updates.last_check'
,
0
);
$last_check
=
$state
->
get
(
'automatic_updates.
cron_
last_check'
,
0
);
// Only allow cron to run once every hour.
// Only allow cron to run once every hour.
if
((
$request_time
-
$last_check
)
<
3600
)
{
if
((
$request_time
-
$last_check
)
<
3600
)
{
return
;
return
;
...
@@ -115,7 +115,7 @@ function automatic_updates_cron() {
...
@@ -115,7 +115,7 @@ function automatic_updates_cron() {
foreach
(
$checker
->
getCategories
()
as
$category
)
{
foreach
(
$checker
->
getCategories
()
as
$category
)
{
$checker
->
run
(
$category
);
$checker
->
run
(
$category
);
}
}
$state
->
set
(
'automatic_updates.last_check'
,
\Drupal
::
time
()
->
getCurrentTime
());
$state
->
set
(
'automatic_updates.
cron_
last_check'
,
\Drupal
::
time
()
->
getCurrentTime
());
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
src/Services/InPlaceUpdate.php
+
5
−
2
View file @
62c2f724
...
@@ -252,12 +252,15 @@ class InPlaceUpdate implements UpdateInterface {
...
@@ -252,12 +252,15 @@ class InPlaceUpdate implements UpdateInterface {
$this
->
httpClient
->
get
(
$url
,
[
$this
->
httpClient
->
get
(
$url
,
[
'sink'
=>
$destination
,
'sink'
=>
$destination
,
'delay'
=>
$delay
,
'delay'
=>
$delay
,
// Some of the core quasi-patch zip files are large, increase timeout.
'timeout'
=>
120
,
]);
]);
}
}
catch
(
RequestException
$exception
)
{
catch
(
RequestException
$exception
)
{
$response
=
$exception
->
getResponse
();
$response
=
$exception
->
getResponse
();
if
(
!
$response
||
(
$retry
=
$response
->
getHeader
(
'Retry-After'
)))
{
if
(
$response
&&
$response
->
getStatusCode
()
===
429
)
{
$this
->
doGetResource
(
$url
,
$destination
,
!
empty
(
$retry
[
0
])
?
$retry
[
0
]
:
10
*
1000
);
$delay
=
1000
*
(
isset
(
$response
->
getHeader
(
'Retry-After'
)[
0
])
?
$response
->
getHeader
(
'Retry-After'
)[
0
]
:
10
);
$this
->
doGetResource
(
$url
,
$destination
,
$delay
);
}
}
else
{
else
{
$this
->
logger
->
error
(
'Retrieval of "@url" failed with: @message'
,
[
$this
->
logger
->
error
(
'Retrieval of "@url" failed with: @message'
,
[
...
...
This diff is collapsed.
Click to expand it.
src/Services/Notify.php
+
2
−
2
View file @
62c2f724
...
@@ -120,9 +120,9 @@ class Notify implements NotifyInterface {
...
@@ -120,9 +120,9 @@ class Notify implements NotifyInterface {
$notify_list
=
$this
->
configFactory
->
get
(
'update.settings'
)
->
get
(
'notification.emails'
);
$notify_list
=
$this
->
configFactory
->
get
(
'update.settings'
)
->
get
(
'notification.emails'
);
if
(
!
empty
(
$notify_list
))
{
if
(
!
empty
(
$notify_list
))
{
$frequency
=
$this
->
configFactory
->
get
(
'automatic_updates.settings'
)
->
get
(
'check_frequency'
);
$frequency
=
$this
->
configFactory
->
get
(
'automatic_updates.settings'
)
->
get
(
'check_frequency'
);
$last_check
=
$this
->
state
->
get
(
'automatic_updates.last_check'
)
?:
0
;
$last_check
=
$this
->
state
->
get
(
'automatic_updates.
notify_
last_check'
)
?:
0
;
if
((
$this
->
time
->
getRequestTime
()
-
$last_check
)
>
$frequency
)
{
if
((
$this
->
time
->
getRequestTime
()
-
$last_check
)
>
$frequency
)
{
$this
->
state
->
set
(
'automatic_updates.last_check'
,
$this
->
time
->
getRequestTime
());
$this
->
state
->
set
(
'automatic_updates.
notify_
last_check'
,
$this
->
time
->
getRequestTime
());
$params
[
'subject'
]
=
new
PluralTranslatableMarkup
(
$params
[
'subject'
]
=
new
PluralTranslatableMarkup
(
count
(
$messages
),
count
(
$messages
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment