Closed bakhshandeh closed 8 months ago
Let's improve it in this way:
1- Save usage
time for each connection in the memory and prune the old ones. It seems that timeline.upgraded
is the time of connection establishment not the time of last usage
2- Add pruneBatchSize
to the connection-pruner
to prune the connection in batch. For example, when max is 1000 and pruneBatchSize = 200
, if number of open connections is more than 1000, connection-pruner
will close 200. It is more effiecient and the pruner does not need to close the connections on each run.
The priority of keeping the connections should be this:
1- being in the same subnet 2- deployer 3- connections that are not used recently
Current code:
If
timeline.upgraded
is the time of connection establishment, then it is not the same as the last time that the connection is used.