If I undestand this correctly, the purpose of what you are doing is to make sure that the user has to wait a few seconds before they can make a second attempt to login?
If this is the case, then what you are doing is a very good idea. It's a good way to do some basic protection against a Denial of Service attack. Someone tries to tie up the server by having the page keep hitting the server/database until they have caused so much delay that everyone else can't get in. Sometimes a simple 5-10 second delay can disrupt these attacks becuase the script they are running against you, normally isn't set up to handle a delay before it can hit you again.
Very good idea, that more people need to implement.