chromatic b37b7e655b Attempt to evict nodes to meet the max conn count
The algorithm here is important and took some time to get right. Instead
of comparing whether the current number of connected nodes minus the
number of unevictable nodes is greater than the number of max
connections, check that:

 * there are any evictable nodes (connected nodes minus unevictable
 nodes)
 * there are more nodes connected than requested (connected nodes minus
 max connections)

While we could wait for nodes to disconnect organically, it's more
important to run the eviction logic frequently enough that we can tell
when it will have an effect.

Whitelisted connections and protected inbound connections are
unevictable, and max connections should account for inbound connections.

Because the evictor will never evict protected inbound connections, the
maximum connection count should always be at least as large as the
protected connection count.

Note that the tests for this use a delay and test that the delay has not
expired. This helps improve determinism in the testing. Otherwise, a
strict test for a fixed number of disconnections is susceptible to
things like CPU jitter, especially when running through CI.

Patrick ran this test for 1000 runs on busy CPUs and saw no failures.
2022-05-08 11:43:42 -07:00
..
2021-12-20 15:45:15 -04:00
2021-02-13 17:24:55 +01:00
2022-04-17 16:34:55 -04:00
2016-12-12 11:08:47 -08:00
2021-12-17 16:19:07 -04:00
2021-12-19 18:08:04 +00:00
2021-09-03 10:52:24 +01:00
2018-09-19 19:22:45 +01:00
2017-01-27 21:22:35 +01:00
2019-03-25 05:36:11 +00:00
2021-11-02 20:36:47 +00:00
2021-11-08 08:22:02 -05:00
2017-01-04 11:56:17 -08:00
2017-01-27 21:22:35 +01:00
2017-02-28 12:48:19 +01:00
2020-01-24 20:16:27 +00:00
2021-09-29 20:50:09 +02:00
2021-12-20 15:45:15 -04:00
2022-04-07 15:56:25 -07:00
2021-09-03 10:52:24 +01:00
2021-02-23 23:31:02 -05:00
2021-02-02 03:54:57 -08:00
2017-06-05 22:58:23 +00:00
2021-02-02 03:54:57 -08:00
2018-09-19 19:22:45 +01:00
2019-03-25 05:36:11 +00:00
2019-03-25 05:36:11 +00:00
2021-02-02 03:54:57 -08:00