(message_id)
return "{:13d}-{}".format(milliseconds, n)
Subtract one from the message ID

    This is useful when we need to xread() events inclusive of the given ID,
    rather than exclusive of the given ID (which is the sensible default).
    Only use when one can tolerate an exceptionally slim risk of grabbing extra events.
Subtract one from the message ID
Subtract one from the message ID
def redis_stream_id_subtract_one(message_id):
    """Subtract one from the message ID

    This is useful when we need to xread() events inclusive of the given ID,
    rather than exclusive of the given ID (which is the sensible default).
    Only use when one can tolerate an exceptionally slim risk of grabbing extra events.
    """
    milliseconds, n = map(int, message_id.split("-"))
    if n > 0:
        n = n - 1
    elif milliseconds > 0:
        milliseconds = milliseconds - 1
        n = 9999
    else:
        # message_id is '0000000000000-0'. Subtracting one
        # from this is neither possible, desirable or useful.
        return message_id
    return "{:13d}-{}".format(milliseconds, n)
def redis_stream_id_subtract_one ( message_id ) : milliseconds , n = map ( int , message_id . split ( "-" ) ) if n > 0 : n = n - 1 elif milliseconds > 0 : milliseconds = milliseconds - 1 n = 9999 else : # message_id is '0000000000000-0'. Subtracting one # from this is neither possible, desirable or useful. return message_id return "{:13d}-{}" . format ( milliseconds , n )