Spaces:
Running
Running
File size: 948 Bytes
6b509f7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
#
# 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) |