Fix for duplicate SQL messages issue

Ensure the state is reset correctly in the read loop when notification is received before state can be changed to expected value.

#2988