- added earliestPublicationDate for App/Models/Dataset.ts
All checks were successful
CI Pipeline / japa-tests (push) Successful in 49s
All checks were successful
CI Pipeline / japa-tests (push) Successful in 49s
- new classes TokenWorkerService.ts, TokenWorker.ts and ResumptionToken.ts for using REDIS with paging OAI results - deletd public/asstes2/langCodeMap.xml: integrated it directly in datasetxml2oai-pmh.xslt - added redis npm package - added TokenWorkerProvider.ts for using singleton of TokenWorkerService inside OaiController.ts - added config/oai.ts for oai related configs from .env-file - adapted XmlModel.ts for grting domDocument from database
This commit is contained in:
parent
2a7480d2ed
commit
7915f66dd6
16 changed files with 691 additions and 89 deletions
61
providers/TokenWorkerProvider.ts
Normal file
61
providers/TokenWorkerProvider.ts
Normal file
|
@ -0,0 +1,61 @@
|
|||
import type { ApplicationContract } from '@ioc:Adonis/Core/Application';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Provider
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Your application is not ready when this file is loaded by the framework.
|
||||
| Hence, the top level imports relying on the IoC container will not work.
|
||||
| You must import them inside the life-cycle methods defined inside
|
||||
| the provider class.
|
||||
|
|
||||
| @example:
|
||||
|
|
||||
| public async ready () {
|
||||
| const Database = this.app.container.resolveBinding('Adonis/Lucid/Database')
|
||||
| const Event = this.app.container.resolveBinding('Adonis/Core/Event')
|
||||
| Event.on('db:query', Database.prettyPrint)
|
||||
| }
|
||||
|
|
||||
*/
|
||||
export default class TokenWorkerProvider {
|
||||
public static needsApplication = true;
|
||||
private tokenWorkerInstance; //: TokenWorkerService | null = null;
|
||||
|
||||
constructor(protected app: ApplicationContract) {}
|
||||
|
||||
public register() {
|
||||
// Register your own bindings
|
||||
// Bind TokenWorker to the IoC container
|
||||
this.app.container.singleton('App/Library/Oai/TokenWorkerContract', () => {
|
||||
// 1. import the oai configuration
|
||||
const ttl: number = 86400;
|
||||
|
||||
// 2. import our REDIS wrapper class
|
||||
const TokenWorkerService = require('App/Library/Oai/TokenWorkerSerice').default;
|
||||
this.tokenWorkerInstance = new TokenWorkerService(ttl);
|
||||
|
||||
// 3. return a new instance
|
||||
return this.tokenWorkerInstance;
|
||||
});
|
||||
}
|
||||
|
||||
// public async boot() {
|
||||
// // All bindings are ready, feel free to use them
|
||||
// // optionally do some initial setup
|
||||
// }
|
||||
|
||||
// public async ready() {
|
||||
// // App is ready
|
||||
// }
|
||||
|
||||
public async shutdown() {
|
||||
console.log('TokenServerProvider shutdown()');
|
||||
// Cleanup, since app is going down
|
||||
if (this.tokenWorkerInstance) {
|
||||
// Call the disconnect method when the application is shutting down
|
||||
await this.tokenWorkerInstance.close();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue