response lifecycle timeout and route handling
This commit is contained in:
@@ -20,6 +20,8 @@ export class MemorySession extends Session {
|
||||
protected sessionID?: string
|
||||
protected data?: SessionData
|
||||
|
||||
constructor() { super() }
|
||||
|
||||
public getKey(): string {
|
||||
if ( !this.sessionID ) throw new NoSessionKeyError()
|
||||
return this.sessionID
|
||||
|
||||
@@ -17,6 +17,8 @@ export class SessionFactory extends AbstractFactory {
|
||||
protected readonly logging: Logging
|
||||
protected readonly config: Config
|
||||
|
||||
private static loggedMemorySessionWarningOnce = false
|
||||
|
||||
constructor() {
|
||||
super({})
|
||||
this.logging = Container.getContainer().make<Logging>(Logging)
|
||||
@@ -24,7 +26,6 @@ export class SessionFactory extends AbstractFactory {
|
||||
}
|
||||
|
||||
produce(dependencies: any[], parameters: any[]): Session {
|
||||
this.logging.warn(`You are using the default memory-based session driver. It is recommended you configure a persistent session driver instead.`)
|
||||
return new (this.getSessionClass())
|
||||
}
|
||||
|
||||
@@ -53,8 +54,11 @@ export class SessionFactory extends AbstractFactory {
|
||||
|
||||
protected getSessionClass() {
|
||||
const SessionClass = this.config.get('server.session.driver', MemorySession)
|
||||
if ( SessionClass === MemorySession && !SessionFactory.loggedMemorySessionWarningOnce ) {
|
||||
this.logging.warn(`You are using the default memory-based session driver. It is recommended you configure a persistent session driver instead.`)
|
||||
SessionFactory.loggedMemorySessionWarningOnce = true
|
||||
}
|
||||
|
||||
// TODO check that session class is valid
|
||||
if ( !isInstantiable(SessionClass) || !(SessionClass.prototype instanceof Session) ) {
|
||||
const e = new ErrorWithContext('Provided session class does not extend from @extollo/lib.Session');
|
||||
e.context = {
|
||||
|
||||
Reference in New Issue
Block a user