handling reconnection to database
handling reconnection to database every 500 ms