Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
siibra-explorer
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiao Gui
siibra-explorer
Commits
2478ad16
Unverified
Commit
2478ad16
authored
4 years ago
by
xgui3783
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #726 from HumanBrainProject/feat_curatedFeatures
bugfix: ready probe
parents
5351679c
0d93f3e0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
deploy/app.js
+3
-3
3 additions, 3 deletions
deploy/app.js
deploy/regionalFeatures/index.js
+5
-5
5 additions, 5 deletions
deploy/regionalFeatures/index.js
with
8 additions
and
8 deletions
deploy/app.js
+
3
−
3
View file @
2478ad16
...
...
@@ -7,7 +7,7 @@ const MemoryStore = require('memorystore')(session)
const
crypto
=
require
(
'
crypto
'
)
const
cookieParser
=
require
(
'
cookie-parser
'
)
const
{
router
:
regionalFeaturesRouter
,
regionalFeature
s
IsReady
}
=
require
(
'
./regionalFeatures
'
)
const
{
router
:
regionalFeaturesRouter
,
regionalFeatureIsReady
}
=
require
(
'
./regionalFeatures
'
)
const
LOCAL_CDN_FLAG
=
!!
process
.
env
.
PRECOMPUTED_SERVER
...
...
@@ -166,7 +166,7 @@ app.use('/logo', require('./logo'))
app
.
get
(
'
/ready
'
,
async
(
req
,
res
)
=>
{
const
authIsReady
=
await
authReady
()
const
regionalFeatureReady
=
await
regionalFeature
s
IsReady
()
const
regionalFeatureReady
=
await
regionalFeatureIsReady
()
const
allReady
=
[
authIsReady
,
regionalFeatureReady
,
...
...
@@ -176,7 +176,7 @@ app.get('/ready', async (req, res) => {
*/
].
every
(
f
=>
!!
f
)
if
(
allReady
)
return
res
.
status
(
200
).
end
()
else
return
res
.
status
(
4
00
).
end
()
else
return
res
.
status
(
5
00
).
end
()
})
/**
...
...
This diff is collapsed.
Click to expand it.
deploy/regionalFeatures/index.js
+
5
−
5
View file @
2478ad16
...
...
@@ -18,12 +18,15 @@ const regionIdToDataIdMap = new Map()
const
datasetIdToDataMap
=
new
Map
()
const
datasetIdDetailMap
=
new
Map
()
let
isReady
=
false
const
ITERABLE_KEY_SYMBOL
=
Symbol
(
'
ITERABLE_KEY_SYMBOL
'
)
/**
* this pattern allows all of the special data to be fetched in parallel
* async await would mean it is fetched one at a time
*/
const
init
=
Promise
.
all
(
arrayToFetch
.
map
(
url
=>
new
Promise
((
rs
,
rj
)
=>
{
...
...
@@ -70,7 +73,7 @@ const init = Promise.all(
})
})
)
)
)
.
then
(()
=>
isReady
=
true
)
const
getFeatureMiddleware
=
(
req
,
res
,
next
)
=>
{
const
{
featureFullId
}
=
req
.
params
...
...
@@ -213,10 +216,7 @@ router.get(
sendFeatureDataResponse
,
)
const
regionalFeatureIsReady
=
()
=>
Promise
.
race
([
init
.
then
(()
=>
true
),
new
Promise
(
rs
=>
setTimeout
(()
=>
rs
(
false
),
500
))
])
const
regionalFeatureIsReady
=
async
()
=>
isReady
module
.
exports
=
{
router
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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