`hive sync` permanently stops on PostgreSQL restart

psycopg2.errors.AdminShutdown: terminating connection due to administrator command
server closed the connection unexpectedly
 This probably means the server terminated abnormally
 before or while processing the request.

It should attempt to reconnect to PostgreSQL in such case as currently even a simple quick restart of database instance can cause hive sync to permanently stop.