Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Renovate Bot
renovate
Commits
960ef9b8
Commit
960ef9b8
authored
5 years ago
by
Dmitry9
Committed by
Rhys Arkins
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
feat(Cargo): cache GitHub-cratesio-index requests for 10 minutes
parent
55829d01
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/datasource/cargo/index.js
+12
-0
12 additions, 0 deletions
lib/datasource/cargo/index.js
with
12 additions
and
0 deletions
lib/datasource/cargo/index.js
+
12
−
0
View file @
960ef9b8
...
@@ -8,6 +8,15 @@ async function getPkgReleases({ lookupName }) {
...
@@ -8,6 +8,15 @@ async function getPkgReleases({ lookupName }) {
if
(
!
lookupName
)
{
if
(
!
lookupName
)
{
return
null
;
return
null
;
}
}
const
cacheNamespace
=
'
cargo
'
;
const
cacheKey
=
lookupName
;
const
cachedResult
=
await
renovateCache
.
get
(
cacheNamespace
,
cacheKey
);
// istanbul ignore if
if
(
cachedResult
)
{
return
cachedResult
;
}
const
len
=
lookupName
.
length
;
const
len
=
lookupName
.
length
;
let
path
;
let
path
;
// Ignored because there is no way to test this without hitting up GitHub API
// Ignored because there is no way to test this without hitting up GitHub API
...
@@ -74,6 +83,9 @@ async function getPkgReleases({ lookupName }) {
...
@@ -74,6 +83,9 @@ async function getPkgReleases({ lookupName }) {
}
}
return
release
;
return
release
;
});
});
const
cacheMinutes
=
10
;
await
renovateCache
.
set
(
cacheNamespace
,
cacheKey
,
result
,
cacheMinutes
);
return
result
;
return
result
;
}
catch
(
err
)
{
}
catch
(
err
)
{
if
(
err
.
statusCode
===
404
||
err
.
code
===
'
ENOTFOUND
'
)
{
if
(
err
.
statusCode
===
404
||
err
.
code
===
'
ENOTFOUND
'
)
{
...
...
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