ai / src /utils /helper.py
hadadrjt's picture
ai: Release J.A.R.V.I.S. Spaces Next-Gen!
6b509f7
raw
history blame
948 Bytes
#
# SPDX-FileCopyrightText: Hadad <[email protected]>
# SPDX-License-Identifier: Apache-2.0
#
from datetime import datetime, timedelta # Import datetime and timedelta classes to work with dates and time durations
# Dictionary to track busy status of servers with their busy expiration timestamps
busy = {}
def mark(server: str):
"""
Mark a server as busy by setting its busy expiration time to one hour from the current UTC time.
Args:
server (str): The identifier or name of the server to mark as busy.
Explanation:
This function updates the 'busy' dictionary by associating the given server
with a timestamp representing one hour from the current UTC time.
This indicates that the server is considered busy until that future time.
"""
# Set the busy expiration time for the specified server to current UTC time plus one hour
busy[server] = datetime.utcnow() + timedelta(hours=1)