Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative approach to fixing serverless-webpack hot reload integration #1090

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/ServerlessOffline.js
Expand Up @@ -47,6 +47,7 @@ export default class ServerlessOffline {
'offline:start:ready': this.ready.bind(this),
'offline:start': this._startWithExplicitEnd.bind(this),
'offline:start:end': this.end.bind(this),
'after:webpack:compile:watch:compile': this.cleanup.bind(this),
}
}

Expand Down Expand Up @@ -136,6 +137,17 @@ export default class ServerlessOffline {
}
}

// Force cleanup lambda functions
async cleanup() {
const eventModules = []

if (this.#lambda) {
serverlessLog('Forcing cleanup of Lambda functions')
eventModules.push(this.#lambda.cleanup())
}
await Promise.all(eventModules)
}

/**
* Entry point for the plugin (sls offline) when running 'sls offline'
* The call to this.end() would terminate the process before 'offline:start:end' could be consumed
Expand Down
2 changes: 1 addition & 1 deletion src/config/defaultOptions.js
Expand Up @@ -28,5 +28,5 @@ export default {
layersDir: null,
dockerReadOnly: true,
functionCleanupIdleTimeSeconds: 60,
allowCache: false,
allowCache: true,
}