Core: Is there any hook before shutdown/reload?

Created on 24 Oct 2019  路  2Comments  路  Source: adonisjs/core

Hi,

I would like to add some clean-up code when service reload (run with --dev) or shutdown (with Crtl+C or something like kill). Is there any hook like beforeShutdown existing in the framework to gracefully shutdown the server?

If there is no such hook, I can use something like process.on('SIGTERM', clean_up_function); but I do not sure what I supposed to call to gracefully stop everything used by adonis

Medium Major Feature Request

Most helpful comment

Hello!

Currently, there is no beforeShutdown hook, however, we do have plans to introduce it in v5

All 2 comments

Hello!

Currently, there is no beforeShutdown hook, however, we do have plans to introduce it in v5

In v5, you can use providers shutdown method to execute actions when processing is shutting down gracefully.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GianCastle picture GianCastle  路  3Comments

Extarys picture Extarys  路  4Comments

ghost picture ghost  路  3Comments

begueradj picture begueradj  路  3Comments

milosdakic picture milosdakic  路  3Comments