add methods to avoid repeatedly logging error messages

* keep a dict with the error messages and the last emit timestamp
* and add a way of clearing this dict when required

Signed-off-by: Tomas Neme <lacrymology@gmail.com>
use the new throttle_errors method on socket errors

don't flood the logging facility if the server is down, or other network
errors keep happening

Signed-off-by: Tomas Neme <lacrymology@gmail.com>
reset the errors dict when we were finally able to contact the server

Signed-off-by: Tomas Neme <lacrymology@gmail.com>
docstring

Signed-off-by: Tomas Neme <lacrymology@gmail.com>
don't fail if the error string doesn't exist in the dict

Signed-off-by: Tomas Neme <lacrymology@gmail.com>
move throttle_error to Handler and use time.time() instead of datetime.now()
Merge pull request #505 from Lacrymology/throttle-logging

Throttle logging