File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 66import psycopg2 .extensions
77import singer
88import singer .schema
9+ import signal
910
1011from singer import utils , metadata , get_bookmark
1112from singer .catalog import Catalog
2122 dump_catalog , clear_state_on_replication_change ,
2223 is_selected_via_metadata , refresh_streams_schema , any_logical_streams )
2324
25+
26+ psycopg2 .extensions .set_wait_callback (psycopg2 .extras .wait_select )
27+
28+
29+ def handle_signal (sig = None , frame = None ):
30+ """
31+ signal handler for sigterms
32+ raise sigint because that's how psycopg2 aborts running queries
33+ """
34+ raise KeyboardInterrupt ("RECEIVED SIGTERM. RAISING SIGINT TO ABORT POSTGRES QUERY" )
35+
36+
37+ signal .signal (signal .SIGTERM , handle_signal )
38+
2439LOGGER = singer .get_logger ('tap_postgres' )
2540
2641REQUIRED_CONFIG_KEYS = [
You can’t perform that action at this time.
0 commit comments