-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move all reference data imports to a single process
We shouldn't be importing this data on a nightly basis. We have functionality that depends on this reference so we should be in control of when and how it gets populated. But just in case we move all the old reference data import jobs to a new 'reference' process which will only ever be manually triggered from here on.
- Loading branch information
1 parent
8925341
commit 8840f91
Showing
15 changed files
with
126 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
src/modules/licence-import/connectors/purpose-conditions-types.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
src/modules/licence-import/jobs/import-purpose-condition-types.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict' | ||
|
||
const ProcessSteps = require('./process-steps.js') | ||
|
||
async function reference (_request, h) { | ||
ProcessSteps.go() | ||
|
||
return h.response().code(204) | ||
} | ||
|
||
module.exports = { | ||
reference | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict' | ||
|
||
const ImportStep = require('./steps/import.js') | ||
|
||
const { calculateAndLogTimeTaken, currentTimeInNanoseconds } = require('../../lib/general.js') | ||
|
||
async function go () { | ||
let processComplete = false | ||
|
||
try { | ||
global.GlobalNotifier.omg('reference started') | ||
|
||
const startTime = currentTimeInNanoseconds() | ||
|
||
await ImportStep.go() | ||
|
||
processComplete = true | ||
|
||
calculateAndLogTimeTaken(startTime, 'reference complete') | ||
} catch (error) { | ||
global.GlobalNotifier.oops('reference failed') | ||
} | ||
|
||
return processComplete | ||
} | ||
|
||
module.exports = { | ||
go | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
'use strict' | ||
|
||
const controllers = require('./controllers') | ||
|
||
const routes = [ | ||
{ | ||
method: 'post', | ||
handler: controllers.reference, | ||
path: '/reference' | ||
} | ||
] | ||
|
||
module.exports = routes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict' | ||
|
||
const db = require('../../../lib/connectors/db.js') | ||
const { calculateAndLogTimeTaken, currentTimeInNanoseconds } = require('../../../lib/general.js') | ||
const ConditionTypeQueries = require('../lib/condition-type-queries.js') | ||
const FinancialAgreementTypeQueries = require('../lib/financial-agreement-type-queries.js') | ||
const PurposeQueries = require('../lib/purpose-queries.js') | ||
|
||
async function go () { | ||
try { | ||
global.GlobalNotifier.omg('reference.import started') | ||
|
||
const startTime = currentTimeInNanoseconds() | ||
|
||
await db.query(ConditionTypeQueries.purposeConditionTypes) | ||
|
||
await db.query(FinancialAgreementTypeQueries.financialAgreementTypes) | ||
|
||
await db.query(PurposeQueries.primaryPurposes) | ||
await db.query(PurposeQueries.secondaryPurposes) | ||
await db.query(PurposeQueries.purposes) | ||
await db.query(PurposeQueries.validPurposeCombinations) | ||
|
||
calculateAndLogTimeTaken(startTime, 'reference.import complete') | ||
} catch (error) { | ||
global.GlobalNotifier.omfg('reference.import errored', error) | ||
throw error | ||
} | ||
} | ||
|
||
module.exports = { | ||
go | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters