salmanishere / pagure

Forked from pagure 5 years ago
Clone

e0ebc15 Use python-redis instead of trollius-redis to correctly clean up when client leaves

Authored and Committed by puiterwijk 6 years ago
    Use python-redis instead of trollius-redis to correctly clean up when client leaves
    
    With trollius-redis, the connection is not released when the client disconnects unless
    someone comments on the issue/PR they had open, because unless something happened on
    the issue they had open, we did not actually send anything to the client.
    As a result, we were not aware whether the client was still connected.
    
    With python-redis, we just check every so often if there's a message, and if not we
    at least try to send a ping to the client every 5 seconds.
    Trying to send data will cause an BrokenPipeError if the client is gone, and thus
    we can correctly clean up.
    
    Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>