def send_users(msg_id, users): """ Send a list of users a message. """ r.set("msg:%s:count" % msg_id, len(users)) for username in users: user.send(username, msg_id)
def send_users(self, users): """ Send a list of users the message. """ r.set("%s:count" % self.key, len(users)) for username in users: user = User(username) user.load() user.send(self.id)
def flushdb(): """ Prepare the database to store users. """ r.set("message_last_id", 0)
def flushdb(): r.set("msg_counter", 0)
def signJWT(user_id: int, role: str): payload = {"id": user_id, "role": role} token = jwt.encode(payload, JWT_SECRET, algorithm=JWT_ALGORITHM) r.set(token, user_id) return token