adding recovery logic for idle connections