Handle `SIGTERM` messages to shut down gracefully
Summary
As brought up in this slack conversation, we have an opportunity to handle SIGTERM messages gracefully.
Proposed benefits
This could improve SDK-based taps' functionality when being told to shut down gracefully.
Proposal details
- For any sorted incremental streams: we can flush the current stream and cancel syncing any other records.
- For non-sorted streams and/or streams which do not support incremental refresh: we may choose to continue syncing until the stream sync completes (or until
SIGKILLforces shutdown). - Avoid starting any other streams once the running streams are handled, as specified above.
Best reasons not to build
No downsides, no reason not to implement.