lago
lago copied to clipboard
misc(events-processor): Keep track of go routines
Context
This PR is part of the Pre-aggregation epic, it follows https://github.com/getlago/lago/pull/606
The main goal of this feature is to setup a complete aggregation pipeline that will be leveraged to compute the customer usage without re-querying the full set of events.
Description
This PR adds a grecefull shutdown logic to the events_processor, and keeps tracks of go routine to make sure that it waits for the ongoing task to be finished before shutting down the application. It also improves the recovery in case of system failures (panic, unhandled errors...)