Fix index error when cleaning out connections.
This commit is contained in:
parent
94ffe8dd74
commit
09c1ff2492
1 changed files with 2 additions and 1 deletions
|
@ -109,7 +109,8 @@ def getNextHourConnection() -> Optional[Connection]:
|
|||
|
||||
def cleanOldConnections() -> None:
|
||||
global connections
|
||||
for i in range(len(connections)):
|
||||
#Go backwards round the loop so that pop's don't interfere with the index.
|
||||
for i in range(len(connections)-1,-1,-1):
|
||||
if connections[i]["endTimestamp"] < datetime.datetime.now().timestamp():
|
||||
connections.pop(i)
|
||||
|
||||
|
|
Loading…
Reference in a new issue