Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
cdn-node-checker
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
cdn-node-checker
Commits
a8248245
Commit
a8248245
authored
Jul 03, 2020
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add retry
parent
5d1fd754
Pipeline
#250
passed with stages
in 1 minute and 15 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
15 deletions
+21
-15
README.md
README.md
+1
-0
config.example.yaml
config.example.yaml
+1
-0
run.ts
run.ts
+19
-15
No files found.
README.md
View file @
a8248245
...
...
@@ -26,6 +26,7 @@ testDomains:
-
ygobbs.com
# Testing sources.
-
nanahira.momobako.com
timeout
:
10000
retryCount
:
3
cronString
:
"
0
*
*
*
*
*"
```
config.example.yaml
View file @
a8248245
...
...
@@ -11,4 +11,5 @@ testDomains:
-
ygobbs.com
# Testing sources.
-
nanahira.momobako.com
timeout
:
10000
retryCount
:
3
cronString
:
"
0
*
*
*
*
*"
run.ts
View file @
a8248245
...
...
@@ -16,6 +16,7 @@ interface Config {
cdnRecords
:
CDNRecord
[];
testDomains
:
string
[];
timeout
:
number
;
retryCount
:
number
;
cronString
:
string
;
}
...
...
@@ -91,23 +92,26 @@ async function getRecords(): Promise<DomainRecordInfo[]> {
async
function
checkNode
(
address
:
string
,
port
:
number
):
Promise
<
boolean
>
{
let
currentTestDomain
:
string
;
try
{
for
(
let
testDomain
of
config
.
testDomains
)
{
currentTestDomain
=
testDomain
;
await
axios
.
get
(
`https://
${
address
}
:
${
port
}
`
,
{
headers
:
{
Host
:
testDomain
},
timeout
:
config
.
timeout
,
validateStatus
:
status
=>
status
<
500
});
for
(
let
i
=
1
;
i
<=
config
.
retryCount
;
++
i
)
{
try
{
for
(
let
testDomain
of
config
.
testDomains
)
{
currentTestDomain
=
testDomain
;
await
axios
.
get
(
`https://
${
address
}
:
${
port
}
`
,
{
headers
:
{
Host
:
testDomain
},
timeout
:
config
.
timeout
,
validateStatus
:
status
=>
status
<
500
});
}
console
.
log
(
`Node
${
address
}
:
${
port
}
is good.`
);
return
true
;
}
catch
(
e
)
{
console
.
log
(
`Node
${
address
}
:
${
port
}
Failed
${
i
}
:
${
e
.
toString
()}
`
);
}
console
.
log
(
`Node
${
address
}
:
${
port
}
is good.`
);
return
true
;
}
catch
(
e
)
{
console
.
log
(
`Node
${
address
}
:
${
port
}
is bad:
${
currentTestDomain
}
=>
${
e
.
toString
()}
`
);
return
false
;
}
console
.
log
(
`Node
${
address
}
:
${
port
}
is bad.`
);
return
false
;
}
async
function
checkRecord
(
recordInfo
:
DomainRecordInfo
)
{
...
...
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