-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
🚀 Feature: Allow to capture shutdown event to make db integrations possible #5688
Labels
product / functions
Fixes and upgrades for the Appwrite Functions.
Comments
Maybe, adding a shutdown function to the primary function. const sdk = require('node-appwrite');
module.exports = async function(req, res) {
const client = new sdk.Client();
/* rest of starter code */
res.json({
areDevelopersAwesome: true
});
};
module.exports.shutdown = async function(req, res) {
const client = new sdk.Client();
/*
* Run any shutdown logic code.
*
* This function will execute only when the container is about
* to get destroyed.
*/
}; |
Discord related post: |
Closed
2 tasks
stnguyen90
added
the
product / functions
Fixes and upgrades for the Appwrite Functions.
label
Jul 6, 2023
Closed
2 tasks
This was referenced Jul 25, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🔖 Feature description
I'm connecting to an external database using a dunction, just to make an integration (not to bypass appwrite).
When the container (that is executing a function) is turned off, allow to capture the graceful shutdown, maybe via SIGTERM, to execute an async method that will destroy the db connections. I tried with process.on('SIGTERM', async () => .....) but it doesn't work.
🎤 Pitch
There are many use cases that needs integrations (sometimes a direct connection to an external db is better to make an api) but It is necessary to close the connections when the container turns off (to avoid db connection leaks).
👀 Have you spent some time to check if this issue has been raised before?
🏢 Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: