Skip to content
This repository was archived by the owner on Nov 5, 2018. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions loadData.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ log() {
echo "$(date +'%Y-%m-%d %H:%M:%S') - $1"
}

warm(){
VIEW=$1

curl -fsS $COUCHDB_URL/_design/views/_view/$VIEW >/dev/null

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very expensive query, since it executes view function against ALL data in DB. I think this works now only because we have small number of records.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One option to reduce the cost of this query might be to run it immediately after the creation of the view when. This would require a higher degree of coupling with the test data however and I'm not sure I like the tradeoff considering that load data on a new DB should be pretty infrequent.

}

loadData() {
log "Loading data from $1"

Expand Down Expand Up @@ -47,3 +53,10 @@ fi
# Submit data
loadData $STATIC_DATA_DIR
loadData $BUILD_DATA_DIR

# Warm Data
log "Warming indices..."
warm findPrefsSafeByGpiiKey
warm findClientByOauth2ClientId
warm findAuthorizationByAccessToken
log "Finished warming indices..."