'Record the resolution of a Future returned by Condition.wait.'

def record_done(self, future, key):

    def callback(_):
        if (not future.result()):
            self.history.append('timeout')
        else:
            self.history.append(key)
    future.add_done_callback(callback)
